Skip to content

Commit 17e54b7

Browse files
committed
Test active script propagation through Web IDL
Follows whatwg/webidl#902.
1 parent 9f61291 commit 17e54b7

11 files changed

+36
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// import()s in eval are resolved relative to the script, even when indirected through Web IDL callbacks
2+
setTimeout(eval, 0, `import('../../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`);

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-external-classic.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
const evaluators = [
3232
"setTimeout",
3333
"eval",
34+
"setTimeout-eval",
3435
"Function",
3536
"reflected-inline-event-handlers",
3637
"inline-event-handlers-UA-code"

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-external-module.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
const evaluators = [
3333
"setTimeout",
3434
"eval",
35+
"setTimeout-eval",
3536
"Function",
3637
"reflected-inline-event-handlers",
3738
"inline-event-handlers-UA-code"

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-classic.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
const evaluators = {
2424
setTimeout,
2525
eval,
26+
"setTimeout + eval"(x) {
27+
setTimeout(eval, 0, x);
28+
},
2629
"the Function constructor"(x) {
2730
Function(x)();
2831
},

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-module.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
const evaluators = {
2424
setTimeout,
2525
eval,
26+
"setTimeout + eval"(x) {
27+
setTimeout(eval, 0, x);
28+
},
2629
"the Function constructor"(x) {
2730
Function(x)();
2831
},

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-classic.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
"the Function constructor"(x) {
2525
Function(x)();
2626
},
27+
"setTimeout + eval"(x) {
28+
setTimeout(eval, 0, x);
29+
},
2730
"reflected inline event handlers"(x) {
2831
dummyDiv.setAttribute("onclick", x);
2932
dummyDiv.onclick();

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-module.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
const evaluators = {
2222
eval,
2323
setTimeout,
24+
"setTimeout + eval"(x) {
25+
setTimeout(eval, 0, x);
26+
},
2427
"the Function constructor"(x) {
2528
Function(x)();
2629
},

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-classic.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
return promise.then(assertSuccessful);
6060
}, "indirect eval must inherit the nonce from the triggering script, thus execute");
6161

62+
promise_test(t => {
63+
const promise = createTestPromise(t);
64+
65+
setTimeout(eval, 0, `import('../imports-a.js?label=direct eval').then(window.continueTest, window.errorTest)`);
66+
67+
return promise.then(assertSuccessful);
68+
}, "setTimeout + eval must inherit the nonce from the triggering script, thus execute");
69+
6270
promise_test(t => {
6371
const promise = createTestPromise(t);
6472

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-nonce-module.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@
5858
return promise.then(assertSuccessful);
5959
}, "indirect eval must inherit the nonce from the triggering script, thus execute");
6060

61+
promise_test(t => {
62+
const promise = createTestPromise(t);
63+
64+
setTimeout(eval, 0, `import('../imports-a.js?label=direct eval').then(window.continueTest, window.errorTest)`);
65+
66+
return promise.then(assertSuccessful);
67+
}, "setTimeout + eval must inherit the nonce from the triggering script, thus execute");
68+
6169
promise_test(t => {
6270
const promise = createTestPromise(t);
6371

html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-of-promise-result.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<meta charset="utf-8">
3-
<title>import() inside compiled strings inside a classic script</title>
3+
<title>Compiling strings resulting from Promise resolution</title>
44
<link rel="help" href="https://github.com/whatwg/html/pull/3163">
55
<link rel="help" href="https://github.com/tc39/ecma262/issues/871#issuecomment-292493142">
66
<link rel="author" title="Domenic Denicola" href="mailto:[email protected]">

0 commit comments

Comments
 (0)