Skip to content

Commit 858788b

Browse files
AtOMiCNebuladomenic
authored andcommitted
ES6 Modules nomodule attribute test cleanup
nomodule-set-on-async-classic-script.html: Remove setTimeout API usage, which can be prone to issues when the test system is slow (i.e. VM on a busy host). This test doesn't need the setTimeout usage though, since the platform should hold off from dispatching window's load event until all async scripts have been executed anyways. nomodule-set-on-synchronously-loaded-classic-scripts.html: Removed dead code.
1 parent a3101d8 commit 858788b

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

html/semantics/scripting-1/the-script-element/nomodule-set-on-async-classic-script.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
window.onload = resolve;
1818
});
1919

20-
waitForAsyncScript = () => {
21-
return new Promise((resolve) => {
22-
waitForLoadEvent.then(() => setTimeout(resolve, 200));
23-
});
24-
}
25-
2620
promise_test(() => {
2721
window.executed = false;
2822
let loaded = false;
@@ -36,7 +30,7 @@
3630
script.noModule = false;
3731
document.body.appendChild(script);
3832

39-
return waitForAsyncScript().then(() => {
33+
return waitForLoadEvent.then(() => {
4034
assert_true(supportsNoModule);
4135
assert_true(executed);
4236
assert_true(loaded);
@@ -56,7 +50,7 @@
5650
script.noModule = true;
5751
document.body.appendChild(script);
5852

59-
return waitForAsyncScript().then(() => {
53+
return waitForLoadEvent.then(() => {
6054
assert_true(supportsNoModule);
6155
assert_false(executed);
6256
assert_false(loaded);

html/semantics/scripting-1/the-script-element/nomodule-set-on-synchronously-loaded-classic-scripts.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
assert_false(errored);
3737
}, 'A synchronously loaded external classic script with nomodule content attribute must not run');
3838

39-
40-
waitForLoadEvent = new Promise((resolve) => {
41-
window.onload = resolve;
42-
});
43-
4439
</script>
4540
</body>
4641
</html>

0 commit comments

Comments
 (0)