-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[blink][wpt] Add more module evaluation order tests
Add tests for upcoming microtask checkpoint fixes and top-level-await for modules. The added test cover in more detail the following items: - onload events - onerror events - queueMicrotask drive-by-fix: Check for onunhandledrejection Bug: 1022182, 1096455, 1114034, v8:9344 Change-Id: Ieaa7691bf44e2758ed873ca53bcc6852812dd723 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2346251 Commit-Queue: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Dominic Farolino <dom@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/master@{#798126}
- Loading branch information
1 parent
23c0ffe
commit f36b6b4
Showing
27 changed files
with
286 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...mantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker-setup.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import "/resources/testharness.js"; | ||
import "./evaluation-order-setup.mjs"; | ||
|
||
import "./evaluation-order-1-nothrow-worker.mjs"; | ||
|
||
import "./evaluation-order-1-nothrow.mjs"; |
10 changes: 10 additions & 0 deletions
10
html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<title>Testing evaluation order</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
const worker = new Worker( | ||
"evaluation-order-1-nothrow-worker-setup.mjs", {type:"module"}); | ||
fetch_tests_from_worker(worker); | ||
</script> |
7 changes: 7 additions & 0 deletions
7
html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow-worker.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
globalThis.expectedLog = [ | ||
"step-1-1", "step-1-2", | ||
"microtask", | ||
]; | ||
|
||
globalThis.test_load.step_timeout(() => globalThis.testDone(), 0); | ||
done(); |
19 changes: 19 additions & 0 deletions
19
html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<title>Testing evaluation order</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script type="module"> | ||
import "./evaluation-order-setup.mjs"; | ||
window.addEventListener("load", ev => globalThis.testDone()); | ||
globalThis.expectedLog = [ | ||
"step-1-1", "step-1-2", | ||
"microtask", | ||
"script-load", | ||
"global-load", | ||
]; | ||
</script> | ||
|
||
<script type="module" src="evaluation-order-1-nothrow.mjs" | ||
onerror="globalThis.unreachable()" | ||
onload="globalThis.log.push('script-load')"></script> |
3 changes: 3 additions & 0 deletions
3
html/semantics/scripting-1/the-script-element/module/evaluation-order-1-nothrow.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
globalThis.log.push("step-1-1"); | ||
queueMicrotask(() => globalThis.log.push("microtask")); | ||
globalThis.log.push("step-1-2"); |
6 changes: 6 additions & 0 deletions
6
html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker-setup.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import "/resources/testharness.js"; | ||
import "./evaluation-order-setup.mjs"; | ||
|
||
import "./evaluation-order-1-worker.mjs"; | ||
|
||
import "./evaluation-order-1.mjs"; |
10 changes: 10 additions & 0 deletions
10
html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<title>Testing evaluation order</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
const worker = new Worker( | ||
"evaluation-order-1-worker-setup.mjs", {type:"module"}); | ||
fetch_tests_from_worker(worker); | ||
</script> |
9 changes: 9 additions & 0 deletions
9
html/semantics/scripting-1/the-script-element/module/evaluation-order-1-worker.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
globalThis.expectedLog = [ | ||
"step-1-1", "step-1-2", | ||
"global-error", "error", | ||
"microtask", | ||
]; | ||
|
||
globalThis.test_load.step_timeout(() => globalThis.testDone(), 0); | ||
|
||
done(); |
20 changes: 20 additions & 0 deletions
20
html/semantics/scripting-1/the-script-element/module/evaluation-order-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<title>Testing evaluation order</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<script type="module"> | ||
import "./evaluation-order-setup.mjs"; | ||
window.addEventListener("load", event => globalThis.testDone()); | ||
globalThis.expectedLog = [ | ||
"step-1-1", "step-1-2", | ||
"global-error", "error", | ||
"microtask", | ||
"script-load", | ||
"global-load" | ||
]; | ||
</script> | ||
|
||
<script type="module" src="evaluation-order-1.mjs" | ||
onerror="unreachable()" onload="log.push('script-load')"></script> |
5 changes: 5 additions & 0 deletions
5
html/semantics/scripting-1/the-script-element/module/evaluation-order-1.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
globalThis.log.push("step-1-1"); | ||
queueMicrotask(() => log.push("microtask")); | ||
globalThis.log.push("step-1-2"); | ||
|
||
throw new Error("error"); |
6 changes: 6 additions & 0 deletions
6
...emantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker-setup.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import "/resources/testharness.js"; | ||
import "./evaluation-order-setup.mjs"; | ||
|
||
import "./evaluation-order-2-import-worker.mjs"; | ||
|
||
import "./evaluation-order-2.1.mjs"; |
10 changes: 10 additions & 0 deletions
10
html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<title>Testing evaluation order</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
const worker = new Worker( | ||
"evaluation-order-2-import-worker-setup.mjs", {type:"module"}); | ||
fetch_tests_from_worker(worker); | ||
</script> |
7 changes: 7 additions & 0 deletions
7
html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import-worker.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
globalThis.expectedLog = [ | ||
"step-2.2-1", "step-2.2-2", | ||
"microtask-2.2", | ||
"global-error", "error", | ||
]; | ||
|
||
done(); |
20 changes: 20 additions & 0 deletions
20
html/semantics/scripting-1/the-script-element/module/evaluation-order-2-import.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<title>Testing evaluation order</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script type="module"> | ||
import "./evaluation-order-setup.mjs"; | ||
globalThis.expectedLog = [ | ||
"step-2.2-1", "step-2.2-2", | ||
"global-error", "error", | ||
"microtask-2.2", | ||
"script-load", | ||
"global-load", | ||
]; | ||
</script> | ||
|
||
<script type="module" src="evaluation-order-2.1.mjs" | ||
onerror="globalThis.unreachable()" | ||
onload="globalThis.log.push('script-load')"> | ||
</script> |
8 changes: 8 additions & 0 deletions
8
html/semantics/scripting-1/the-script-element/module/evaluation-order-2.1.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
globalThis.log.push("step-2.1-1"); | ||
queueMicrotask(() => globalThis.log.push("microtask-2.1")); | ||
globalThis.log.push("step-2.1-2"); | ||
|
||
// import is evaluated first. | ||
import "./evaluation-order-2.2.mjs"; | ||
|
||
globalThis.log.push("step-2.1-3"); |
7 changes: 7 additions & 0 deletions
7
html/semantics/scripting-1/the-script-element/module/evaluation-order-2.2.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
globalThis.log.push("step-2.2-1"); | ||
queueMicrotask(() => globalThis.log.push("microtask-2.2")); | ||
globalThis.log.push("step-2.2-2"); | ||
|
||
globalThis.test_load.step_timeout(() => globalThis.testDone(), 0); | ||
|
||
throw new Error("error"); |
6 changes: 6 additions & 0 deletions
6
...mantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker-setup.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import "/resources/testharness.js"; | ||
import "./evaluation-order-setup.mjs"; | ||
|
||
import "./evaluation-order-3-dynamic-worker.mjs"; | ||
|
||
import "./evaluation-order-3.1.mjs"; |
11 changes: 11 additions & 0 deletions
11
html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
|
||
<title>Testing evaluation order</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
const worker = new Worker( | ||
"evaluation-order-3-dynamic-worker-setup.mjs", {type:"module"}); | ||
fetch_tests_from_worker(worker); | ||
</script> |
8 changes: 8 additions & 0 deletions
8
html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic-worker.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
globalThis.expectedLog = [ | ||
"step-3.1-1", "step-3.1-2", "step-3.1-3", | ||
"microtask-3.1", | ||
"step-3.2-1", "step-3.2-2", | ||
"microtask-3.2", | ||
"import-catch", "error", | ||
]; | ||
done(); |
19 changes: 19 additions & 0 deletions
19
html/semantics/scripting-1/the-script-element/module/evaluation-order-3-dynamic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<title>Testing evaluation order</title> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script type="module"> | ||
import "./evaluation-order-setup.mjs"; | ||
globalThis.expectedLog = [ | ||
"step-3.1-1", "step-3.1-2", "step-3.1-3", "microtask-3.1", | ||
"script-load", | ||
"step-3.2-1", "step-3.2-2", "microtask-3.2", | ||
"import-catch", "error" | ||
]; | ||
</script> | ||
|
||
<script type="module" src="evaluation-order-3.1.mjs" | ||
onerror="globalThis.unreachable()" | ||
onload="globalThis.log.push('script-load')"> | ||
</script> |
11 changes: 11 additions & 0 deletions
11
html/semantics/scripting-1/the-script-element/module/evaluation-order-3.1.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
globalThis.log.push("step-3.1-1"); | ||
queueMicrotask(() => globalThis.log.push("microtask-3.1")); | ||
globalThis.log.push("step-3.1-2"); | ||
|
||
import("./evaluation-order-3.2.mjs").catch( | ||
exception => { | ||
globalThis.log.push("import-catch", exception.message); | ||
globalThis.testDone(); | ||
}); | ||
|
||
globalThis.log.push("step-3.1-3"); |
5 changes: 5 additions & 0 deletions
5
html/semantics/scripting-1/the-script-element/module/evaluation-order-3.2.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
globalThis.log.push("step-3.2-1"); | ||
queueMicrotask(() => globalThis.log.push("microtask-3.2")); | ||
globalThis.log.push("step-3.2-2"); | ||
|
||
throw new Error("error"); |
19 changes: 19 additions & 0 deletions
19
html/semantics/scripting-1/the-script-element/module/evaluation-order-setup.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
globalThis.setup({allow_uncaught_exception: true}); | ||
|
||
globalThis.log = []; | ||
|
||
globalThis.addEventListener("error", | ||
event => globalThis.log.push("global-error", event.error.message)); | ||
globalThis.addEventListener("onunhandledrejection", | ||
event => globalThis.log.push('unhandled-promise-rejection')); | ||
globalThis.addEventListener("load", | ||
event => globalThis.log.push("global-load")); | ||
|
||
globalThis.unreachable = function() { | ||
globalThis.log.push("unreachable"); | ||
} | ||
|
||
globalThis.test_load = async_test("Test evaluation order of modules"); | ||
globalThis.testDone = globalThis.test_load.step_func_done(() => { | ||
assert_array_equals(globalThis.log, globalThis.expectedLog); | ||
}); |