-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
import() should use referring script's base URL as the referrer #3744
Comments
/cc @hiroshige-g @nyaxt and me. We're now adding WPTs for referrer on module workers. |
Any update on the status here (tests or spec)? |
It looks like the spec still does not do this, but it would be much easier to change now. I think it's just a matter of changing https://html.spec.whatwg.org/multipage/webappapis.html#fetch-an-import()-module-script-graph step 3 to pass base URL instead of "client". |
Regarding the tests, we have auto-generated tests for top-level worker module script loading, but not yet for |
Ah, I just remembered there're also hand-written tests including
It would be nice to move these tests into the test generator framework. |
I was testing this issue, and it looks like Firefox implements the proposed behavior while Webkit and Chromium implement the specified behavior. I was looking at wpt tests, but I couldn't find any. Would it be ok to just duplicate all the
Should the tests include all the referrer policy combinations, or given that this change would affect which referrer is passed and not when it would be enough to test the default one? |
Duplicating (or abstracting) sounds fine. And no need to test all combinations. Thanks! |
Thank you! PR opened. |
Remove the explicit non-propagation of the referrer for dynamic import() calls, and fix #3744. By doing so, we align fetching static and dynamic imports.
Remove the explicit non-propagation of the referrer for dynamic import() calls, and fix whatwg#3744. By doing so, we align fetching static and dynamic imports.
Remove the explicit non-propagation of the referrer for dynamic import() calls, and fix whatwg#3744. By doing so, we align fetching static and dynamic imports.
Right now we treat
import()
as a "new" module script graph, i.e. it calls fetch a module script graph directly. This then uses "client" as the referrer, i.e. it uses the base URL of the appropriate settings object.But this seems semantically wrong. import() knows what script it's being called from; it uses that information to compute URLs and and fetch options. It should also use that to compute the referrer information.
Found by @jonco3. /cc @whatwg/modules. I will try to work on a spec fix and tests for this soon...
The text was updated successfully, but these errors were encountered: