Propagate fetch referrer in dynamic imports#9407
Merged
domenic merged 1 commit intowhatwg:mainfrom Jul 4, 2023
Merged
Conversation
Member
|
@hiroshige-g and/or @domfarolino do you think Chrome would be willing to change this? |
Member
|
I'm just getting back from vacation, so I'll try and take a look this week. |
Member
|
I'm willing to implement this in Chromium, so I guess we should get signals from WebKit/Gecko now. |
3 tasks
Collaborator
Author
|
cc @jonco3 since you originally found this |
|
Yes, Mozilla support this change. |
domenic
approved these changes
Jul 4, 2023
domenic
pushed a commit
to web-platform-tests/wpt
that referenced
this pull request
Jul 4, 2023
Member
|
Thanks for your work here @nicolo-ribaudo! Can you file Chromium and WebKit bugs, and edit the OP to link to them? |
Collaborator
Author
|
Done 👍 |
moz-v2v-gh
pushed a commit
to mozilla/gecko-dev
that referenced
this pull request
Jul 12, 2023
… a=testonly Automatic update from web-platform-tests Add test for referrer in module imports Follows whatwg/html#9407. -- wpt-commits: 66166fa9af2d53656da3f04a0f5e114e740a00c7 wpt-pr: 40474
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-wordified-and-comments-removed
that referenced
this pull request
Jul 16, 2023
… a=testonly Automatic update from web-platform-tests Add test for referrer in module imports Follows whatwg/html#9407. -- wpt-commits: 66166fa9af2d53656da3f04a0f5e114e740a00c7 wpt-pr: 40474 UltraBlame original commit: 2b00c3c10894b1c7b804678961e67f9bb0c007f7
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-comments-removed
that referenced
this pull request
Jul 16, 2023
… a=testonly Automatic update from web-platform-tests Add test for referrer in module imports Follows whatwg/html#9407. -- wpt-commits: 66166fa9af2d53656da3f04a0f5e114e740a00c7 wpt-pr: 40474 UltraBlame original commit: 2b00c3c10894b1c7b804678961e67f9bb0c007f7
gecko-dev-updater
pushed a commit
to marco-c/gecko-dev-wordified
that referenced
this pull request
Jul 16, 2023
… a=testonly Automatic update from web-platform-tests Add test for referrer in module imports Follows whatwg/html#9407. -- wpt-commits: 66166fa9af2d53656da3f04a0f5e114e740a00c7 wpt-pr: 40474 UltraBlame original commit: 2b00c3c10894b1c7b804678961e67f9bb0c007f7
aarongable
pushed a commit
to chromium/chromium
that referenced
this pull request
Jul 19, 2023
This CL implements whatwg/html#9407, which makes the request referrer for dynamic import() requests equal to the referring script's base URL. This already was the case for static imports, but now we do the same for dynamic imports. The implementation is more complicated than the spec change because in the spec, "fetch a single module script" takes in a referrer for use in fetching, whereas in our implementation, we don't compute the referrer until later in the process, and by this time we already have lost access to the `ReferrerScriptInfo` that we have for dynamic imports. So the way this CL works is that inside `DynamicModuleResolver::ResolveDynamically()`, we capture the referrer script's base URL (for use as the referrer in the import request) — and pass it through as a new optional parameter, simulating the spec's already-existing `referrer` parameter to "fetch a single module script" — to the following methods: Modulator::FetchTree ModuleTreeLinkerRegistry::Fetch ModuleTreeLinker::FetchRoot * use the new optional `referrer` argument to create the module script request, as "fetch a single module script" does with its `referrer` parameter in the spec [1] [1]: https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts:fetch-a-single-module-script-4 R=hiroshige@chromium.org Bug: 1461987 Change-Id: I538a087acfb0113cdf5efa9f69947c605b2c0593 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4678043 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#1172405}
jwidar
pushed a commit
to jwidar/LatencyZeroGithub
that referenced
this pull request
Sep 16, 2025
… a=testonly Automatic update from web-platform-tests Add test for referrer in module imports Follows whatwg/html#9407. -- wpt-commits: 66166fa9af2d53656da3f04a0f5e114e740a00c7 wpt-pr: 40474
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change removes the explicit non-propagation of the referrer for dynamic
import()calls, and fixes #3744. By doing so, it aligns fetching static and dynamic imports.Note that the spec doesn't include the explicit exception for
import()because it has been explicitly wanted, but because this distinction happened accidentally when static and dynamic imports had two separate paths and I had to add it explicitly when unifying them in #8253.Firefox currently implements the new behavior, while Webkit and Chroimum implement the old behavior.
DenoDeno only passes theAccept,Accept-Encoding,HostandUser-AgentheadersNode.jsNode.js only passes theAccept,ConnectionandHostheaders/webappapis.html ( diff )