Skip to content

Add test for referrer in module imports#40474

Merged
domenic merged 3 commits intoweb-platform-tests:masterfrom
nicolo-ribaudo:import-referrer
Jul 4, 2023
Merged

Add test for referrer in module imports#40474
domenic merged 3 commits intoweb-platform-tests:masterfrom
nicolo-ribaudo:import-referrer

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo commented Jun 9, 2023

This PR adds tests for the referrer used by fetches of modules imported using import statements and dynamic import().

The first commit adds tests for the currently specified behavior, while the second commit updates it to match the behavior proposed in whatwg/html#3744 to align static and dynamic imports.

From my manual tests, Firefox implements the new behavior while Webkit and Chromium implement the current behavior.

There is something wrong with the tests, because Chrome and Safari only run the first one, but I cannot figure out why. If I delete the first test, then they only run the second one (that becomes first).

@nicolo-ribaudo
Copy link
Copy Markdown
Member Author

@annevk Do you know what might be causing this?

There is something wrong with the tests, because Chrome and Safari only run the first one, but I cannot figure out why. If I delete the first test, then they only run the second one (that becomes first).

I see it happening both locally and on CI (https://github.com/web-platform-tests/wpt/pull/40474/checks?check_run_id=14137937410 should show 3/4)

@annevk
Copy link
Copy Markdown
Member

annevk commented Jun 12, 2023

Oh sorry I missed that. Maybe @domenic can help with that. I'm surprised we have dedicatedworker-module but not window-module. Perhaps using dedicatedworker-module as per https://web-platform-tests.org/writing-tests/testharness.html#tests-for-other-or-multiple-globals-any-js would be a way around this problem though? (Although I don't really know what the support level for that is at the moment.)

@nicolo-ribaudo
Copy link
Copy Markdown
Member Author

nicolo-ribaudo commented Jun 29, 2023

Test fixed, the problem was top-level await. Thanks @lucacasonato for helping with this!

@domenic domenic merged commit 66166fa into web-platform-tests:master Jul 4, 2023
@nicolo-ribaudo nicolo-ribaudo deleted the import-referrer branch July 4, 2023 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants