fune/testing/web-platform/tests/import-maps/import-maps-base-url.sub.html
Yusuke Suzuki 6b5de3ba3e Bug 1796899 [wpt PR 36125] - Make import-maps iframe tests deterministic, a=testonly
Automatic update from web-platform-tests
Make import-maps iframe tests deterministic (#36125)

We found that import-maps' iframe tests are relying on particular order of script execution in iframes.
This patch makes them serialized and deterministic order by the following three changes.

1. Align fetch_tests_from_window to fetch_tests_from_worker so that
   it can return a promise from RemoteContext.
2. Use async / await in import-maps' doTests helper function to serialize
   iframe tests. And use promise_setup to collect all tests from iframes
   asynchronously.
3. Apply (2)'s change to import-maps/import-maps-base-url.sub.html too.
--

wpt-commits: 4e0e073c66f02400e4c5ba89dc69411f6ca2c41a
wpt-pr: 36125
2022-11-07 10:54:06 +00:00

38 lines
1.2 KiB
HTML

<!DOCTYPE html>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helper.js"></script>
<script>
// baseURL will be used to create a <base> element, which will change the
// baseURL of the import map.
const baseURL = "http://{{host}}:{{ports[http][0]}}/import-maps/resources/";
const importMap = `
{
"imports": {
"bare/bare": "./log.js?pipe=sub&name=bare"
}
}
`;
promise_setup(function () {
return new Promise((resolve) => {
window.addEventListener("load", async () => {
await testStaticImport(importMap, baseURL, "bare/bare", "log:bare");
await testDynamicImport(importMap, baseURL, "bare/bare", "log:bare", "module");
await testDynamicImport(importMap, baseURL, "bare/bare", "log:bare", "text/javascript");
await testStaticImportInjectBase(importMap, baseURL, "bare/bare", "log:bare");
await testDynamicImportInjectBase(importMap, baseURL, "bare/bare", "log:bare", "module");
await testDynamicImportInjectBase(importMap, baseURL, "bare/bare", "log:bare", "text/javascript");
done();
resolve();
});
});
}, { explicit_done: true });
</script>
<body>