Skip to content

Commit

Permalink
Test active script propagation through Web IDL
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic committed Jul 9, 2020
1 parent 9f61291 commit 17e54b7
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// import()s in eval are resolved relative to the script, even when indirected through Web IDL callbacks
setTimeout(eval, 0, `import('../../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`);
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
const evaluators = [
"setTimeout",
"eval",
"setTimeout-eval",
"Function",
"reflected-inline-event-handlers",
"inline-event-handlers-UA-code"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
const evaluators = [
"setTimeout",
"eval",
"setTimeout-eval",
"Function",
"reflected-inline-event-handlers",
"inline-event-handlers-UA-code"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
const evaluators = {
setTimeout,
eval,
"setTimeout + eval"(x) {
setTimeout(eval, 0, x);
},
"the Function constructor"(x) {
Function(x)();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
const evaluators = {
setTimeout,
eval,
"setTimeout + eval"(x) {
setTimeout(eval, 0, x);
},
"the Function constructor"(x) {
Function(x)();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"the Function constructor"(x) {
Function(x)();
},
"setTimeout + eval"(x) {
setTimeout(eval, 0, x);
},
"reflected inline event handlers"(x) {
dummyDiv.setAttribute("onclick", x);
dummyDiv.onclick();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
const evaluators = {
eval,
setTimeout,
"setTimeout + eval"(x) {
setTimeout(eval, 0, x);
},
"the Function constructor"(x) {
Function(x)();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
return promise.then(assertSuccessful);
}, "indirect eval must inherit the nonce from the triggering script, thus execute");

promise_test(t => {
const promise = createTestPromise(t);

setTimeout(eval, 0, `import('../imports-a.js?label=direct eval').then(window.continueTest, window.errorTest)`);

return promise.then(assertSuccessful);
}, "setTimeout + eval must inherit the nonce from the triggering script, thus execute");

promise_test(t => {
const promise = createTestPromise(t);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@
return promise.then(assertSuccessful);
}, "indirect eval must inherit the nonce from the triggering script, thus execute");

promise_test(t => {
const promise = createTestPromise(t);

setTimeout(eval, 0, `import('../imports-a.js?label=direct eval').then(window.continueTest, window.errorTest)`);

return promise.then(assertSuccessful);
}, "setTimeout + eval must inherit the nonce from the triggering script, thus execute");

promise_test(t => {
const promise = createTestPromise(t);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>import() inside compiled strings inside a classic script</title>
<title>Compiling strings resulting from Promise resolution</title>
<link rel="help" href="https://github.com/whatwg/html/pull/3163">
<link rel="help" href="https://github.com/tc39/ecma262/issues/871#issuecomment-292493142">
<link rel="author" title="Domenic Denicola" href="mailto:[email protected]">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
const evaluators = {
eval: otherWindow.eval,
setTimeout: otherWindow.setTimeout,
"setTimeout + eval"(x) {
otherWindow.setTimeout(otherWIndow.eval, 0, x);
},
"the Function constructor"(x) {
otherWindow.Function(x)();
},
Expand Down

0 comments on commit 17e54b7

Please sign in to comment.