Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return a content-encoding header for resource timing and more #1796

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

guohuideng2024
Copy link

@guohuideng2024 guohuideng2024 commented Dec 13, 2024

The major change is to add content-encoding to response header list. This PR also adds description on how content-encoding is determined. (content negotiation)

The purpose is to pass such value to resource timing. Further details are available at
w3c/resource-timing#381.

Note: Per discussion at 12/05/2024 webPerWG call (https://docs.google.com/document/d/1mpFDrAWuV6IgvJ1KiL9sgIlcboC5uArtF8r_oqS1Sco/edit?tab=t.0#heading=h.af6v74wysf4m), we decided to allow arbitrary "content-encoding" value at "fetch". We only filter such value at client side, before passing the value to resource timing.

Related PR to modify resource timing specification:
w3c/resource-timing#411

(See WHATWG Working Mode: Changes for more details.)

Bug: w3c/resource-timing#381


Preview | Diff

fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
@annevk
Copy link
Member

annevk commented Jan 7, 2025

Thanks for taking the time to pick this up. However, it doesn't seem like this addresses all the issues with #1742? I recommend studying the feedback on that PR.

@guohuideng2024
Copy link
Author

Thanks for taking the time to pick this up. However, it doesn't seem like this addresses all the issues with #1742? I recommend studying the feedback on that PR.

Hi Anne! I think I should have put up some background information here.

  1. You mentioned in Pass in Content-Encoding to resource-timing #1742 that the spec must define how the value is determined. This PR is trying to do that. The value is a result of the "content negotiation" (determine what encoding should be used) so I tried to add that into the existing text.
    Note that Pass in Content-Encoding to resource-timing #1742 is a change similar to one for a previously added field contentType. But contentEncoding is very different, it's not an extracted MIME type, but a result of "content negotiation". So, this PR should be very different from Pass in Content-Encoding to resource-timing #1742

  2. We originally thought that the filtering should happen at the "fetch" stage. But in the last web perf meeting Patrick brought up that the returned contentEncoding can be a proprietary value and that value is needed by service worker. So, the unfiltered value must be kept by the browser and the filtering should happen right before reported to resourceTiming.

https://docs.google.com/document/d/1mpFDrAWuV6IgvJ1KiL9sgIlcboC5uArtF8r_oqS1Sco/edit?tab=t.0#heading=h.af6v74wysf4m

Therefore, in this fetch doc I didn't mention filtering. I mentioned "filtering" in the resourceTiming spec:
w3c/resource-timing#411
And I am going to add more details about the filtering there.

Does this sound right to you? I am new to fetch and I may have missed a lot of things here. Thanks for your patience and guidance.
Guohui

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 16, 2025
This CL introduce a contentEncoding field to Performance resource timing
object. This field is behind a feature flag.

PR to resource timing specification:
w3c/resource-timing#411
PR to fetch specification:
whatwg/fetch#1796

Bug: 327941462
Change-Id: I70cad190fe658fb3dbf8b401ff8393bc1d0782f0
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 16, 2025
This CL introduce a contentEncoding field to Performance resource timing
object. This field is behind a feature flag.

PR to resource timing specification:
w3c/resource-timing#411
PR to fetch specification:
whatwg/fetch#1796

Bug: 327941462
Change-Id: I70cad190fe658fb3dbf8b401ff8393bc1d0782f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6098321
Commit-Queue: Guohui Deng <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Reviewed-by: Matthew Denton <[email protected]>
Reviewed-by: Yoav Weiss (@Shopify) <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1407331}
aarongable pushed a commit to chromium/chromium that referenced this pull request Jan 16, 2025
This CL introduce a contentEncoding field to Performance resource timing
object. This field is behind a feature flag.

PR to resource timing specification:
w3c/resource-timing#411
PR to fetch specification:
whatwg/fetch#1796

Bug: 327941462
Change-Id: I70cad190fe658fb3dbf8b401ff8393bc1d0782f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6098321
Commit-Queue: Guohui Deng <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Reviewed-by: Matthew Denton <[email protected]>
Reviewed-by: Yoav Weiss (@Shopify) <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1407331}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 16, 2025
This CL introduce a contentEncoding field to Performance resource timing
object. This field is behind a feature flag.

PR to resource timing specification:
w3c/resource-timing#411
PR to fetch specification:
whatwg/fetch#1796

Bug: 327941462
Change-Id: I70cad190fe658fb3dbf8b401ff8393bc1d0782f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6098321
Commit-Queue: Guohui Deng <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Reviewed-by: Matthew Denton <[email protected]>
Reviewed-by: Yoav Weiss (@Shopify) <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1407331}
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jan 21, 2025
…ourceTiming, a=testonly

Automatic update from web-platform-tests
Expose contentEncoding in PerformanceResourceTiming

This CL introduce a contentEncoding field to Performance resource timing
object. This field is behind a feature flag.

PR to resource timing specification:
w3c/resource-timing#411
PR to fetch specification:
whatwg/fetch#1796

Bug: 327941462
Change-Id: I70cad190fe658fb3dbf8b401ff8393bc1d0782f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6098321
Commit-Queue: Guohui Deng <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Reviewed-by: Matthew Denton <[email protected]>
Reviewed-by: Yoav Weiss (@Shopify) <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1407331}

--

wpt-commits: 1df2c3e47bcb6379ecf3a07735bd967101d02a5b
wpt-pr: 50115
guohuideng2024 and others added 2 commits January 21, 2025 15:54
1) formatting;
2) "gzip, GZIP" is ok for they case-insensitive match.
3) there is a mistake saying that the "contentEncoding" consists of
digits;
4) no longer returns "contentEncoding" for data url.
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
That's on the client side getting the reponse header.
fetch.bs Outdated Show resolved Hide resolved
Just add the content encoding to body info.
@guohuideng2024
Copy link
Author

Updated the patch, I just added the content encoding to the body info struct, and add the clause that updates it.

fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Show resolved Hide resolved
@guohuideng2024
Copy link
Author

very sorry for so many mistakes folks. Thanks for you guys' patence.

@noamr
Copy link
Contributor

noamr commented Jan 23, 2025

very sorry for so many mistakes folks. Thanks for you guys' patence.

No worries, we've all been there! (Or at least I have...)

i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jan 24, 2025
…ourceTiming, a=testonly

Automatic update from web-platform-tests
Expose contentEncoding in PerformanceResourceTiming

This CL introduce a contentEncoding field to Performance resource timing
object. This field is behind a feature flag.

PR to resource timing specification:
w3c/resource-timing#411
PR to fetch specification:
whatwg/fetch#1796

Bug: 327941462
Change-Id: I70cad190fe658fb3dbf8b401ff8393bc1d0782f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6098321
Commit-Queue: Guohui Deng <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Reviewed-by: Matthew Denton <[email protected]>
Reviewed-by: Yoav Weiss (@Shopify) <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1407331}

--

wpt-commits: 1df2c3e47bcb6379ecf3a07735bd967101d02a5b
wpt-pr: 50115
fetch.bs Outdated Show resolved Hide resolved
@noamr
Copy link
Contributor

noamr commented Jan 30, 2025

I think this is OK with me, passing on to @annevk. Thanks for addressing the issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants