Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/scripting-1/the-script-element/module/dynamic-import/delay-load-event.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Dynamic imports don't delay the load event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// Dynamic imports don't #delay-the-load-event.
// Therefore, Window load event would be fired
// just after the dynamic import() below starts.
window.loaded = [];
window.addEventListener('load', () => loaded.push('Window load event'));
promise_test(t => {
loaded.push('import start');
// This 'loading' log is added to detect the previous Chromium behavior
// where the Window load event is delayed until just before script
// element's load event.
t.step_timeout(() => loaded.push('loading'), 1000);
return import("../resources/slow-module.js?pipe=trickle(d2)")
.then(() => {
assert_array_equals(
loaded,
['import start', 'Window load event', 'loading', 'slow'],
"Window load event shouldn't be delayed by dynamic imports");
});
}, "Dynamic imports don't delay the load event.");
</script>