-
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.
Enable ShadowRealm tests for queueMicrotask and microtask evaluation …
…order
- Loading branch information
Showing
8 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...ng-1/the-script-element/microtasks/checkpoint-after-shadowrealmglobalscope-onerror.any.js
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,32 @@ | ||
// META: title=Microtask checkpoint after ShadowRealm onerror events | ||
// META: global=shadowrealm | ||
|
||
// Adapted from first part of ./resources/checkpoint-after-error-event.js. | ||
|
||
setup({allow_uncaught_exception: true}); | ||
|
||
var log = []; | ||
|
||
addEventListener('error', () => { | ||
log.push('handler 1'); | ||
Promise.resolve().then(() => log.push('handler 1 promise')); | ||
}); | ||
addEventListener('error', () => { | ||
log.push('handler 2'); | ||
Promise.resolve().then(() => log.push('handler 2 promise')); | ||
}); | ||
|
||
async_test(t => { | ||
t.step_timeout(() => { | ||
assert_array_equals(log, [ | ||
'handler 1', | ||
'handler 2', | ||
'handler 1 promise', | ||
'handler 2 promise' | ||
]); | ||
t.done(); | ||
}, | ||
0); | ||
}, "Promise resolved during #report-the-error"); | ||
|
||
queueMicrotask(() => thisFunctionDoesNotExist()); |
4 changes: 2 additions & 2 deletions
4
...scripting-1/the-script-element/microtasks/evaluation-order-1-nothrow-static-import.any.js
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// META: global=dedicatedworker-module,sharedworker-module | ||
// META: script=./resources/evaluation-order-setup.js | ||
// META: global=dedicatedworker-module,sharedworker-module,shadowrealm | ||
// META: script=/html/semantics/scripting-1/the-script-element/microtasks/resources/evaluation-order-setup.js | ||
|
||
import './resources/evaluation-order-1-nothrow-setup.js'; | ||
import './resources/evaluation-order-1-nothrow.js'; |
4 changes: 2 additions & 2 deletions
4
...s/scripting-1/the-script-element/microtasks/evaluation-order-1-throw-static-import.any.js
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// META: global=dedicatedworker-module,sharedworker-module | ||
// META: script=./resources/evaluation-order-setup.js | ||
// META: global=dedicatedworker-module,sharedworker-module,shadowrealm | ||
// META: script=/html/semantics/scripting-1/the-script-element/microtasks/resources/evaluation-order-setup.js | ||
|
||
import './resources/evaluation-order-1-throw-setup.js'; | ||
import './resources/evaluation-order-1-throw.js'; |
4 changes: 2 additions & 2 deletions
4
html/semantics/scripting-1/the-script-element/microtasks/evaluation-order-2.any.js
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// META: global=dedicatedworker-module,sharedworker-module | ||
// META: script=./resources/evaluation-order-setup.js | ||
// META: global=dedicatedworker-module,sharedworker-module,shadowrealm | ||
// META: script=/html/semantics/scripting-1/the-script-element/microtasks/resources/evaluation-order-setup.js | ||
|
||
import './resources/evaluation-order-2-setup.js'; | ||
import './resources/evaluation-order-2.1.mjs'; |
4 changes: 2 additions & 2 deletions
4
html/semantics/scripting-1/the-script-element/microtasks/evaluation-order-3.any.js
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// META: global=dedicatedworker-module,sharedworker-module | ||
// META: script=./resources/evaluation-order-setup.js | ||
// META: global=dedicatedworker-module,sharedworker-module,shadowrealm | ||
// META: script=/html/semantics/scripting-1/the-script-element/microtasks/resources/evaluation-order-setup.js | ||
|
||
import './resources/evaluation-order-3-setup.js'; | ||
import './resources/evaluation-order-3.1.mjs'; |
2 changes: 1 addition & 1 deletion
2
html/webappapis/microtask-queuing/queue-microtask-exceptions.any.js
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// META: global=window,worker | ||
// META: global=window,worker,shadowrealm | ||
"use strict"; | ||
|
||
setup({ | ||
|
33 changes: 33 additions & 0 deletions
33
...appapis/microtask-queuing/queue-microtask-shadowrealm-callback-report-exception.window.js
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,33 @@ | ||
// META: title=Errors thrown by wrapped microtask in ShadowRealm | ||
|
||
setup({ allow_uncaught_exception: true }); | ||
|
||
const realm = new ShadowRealm(); | ||
|
||
const onerrorCalls = []; | ||
window.onerror = e => { | ||
onerrorCalls.push("Window"); | ||
}; | ||
realm.evaluate(`(push) => { | ||
onerror = function (e) { | ||
const assertResult = e instanceof TypeError; | ||
push(assertResult); | ||
}; | ||
}`)(assertResult => { | ||
onerrorCalls.push("ShadowRealm"); | ||
assert_true(assertResult, | ||
"exception should be converted to a fresh ShadowRealm TypeError") | ||
}); | ||
|
||
async_test(t => { | ||
window.onload = t.step_func(() => { | ||
const task = () => { throw new Error("PASS"); }; | ||
realm.evaluate(`queueMicrotask`)(task); | ||
|
||
t.step_timeout(() => { | ||
assert_array_equals(onerrorCalls, ["ShadowRealm"], | ||
"exception should be reported in ShadowRealm's onerror handler"); | ||
t.done(); | ||
}, 4); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// META: global=window,worker | ||
// META: global=window,worker,shadowrealm | ||
"use strict"; | ||
|
||
test(() => { | ||
|