mirror of
https://github.com/servo/servo.git
synced 2025-06-28 02:53:48 +01:00
Update web-platform-tests to revision 345300fad3945a5f1441fb2b2001109ca48f36e8
This commit is contained in:
parent
71ba247942
commit
05db47be0f
109 changed files with 2576 additions and 1228 deletions
|
@ -1 +1,2 @@
|
|||
// import()s in a dynamically created function are resolved relative to the script.
|
||||
Function(`import('../../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`)();
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
// import()s in eval are resolved relative to the script.
|
||||
eval(`import('../../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`);
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
window.dummyDiv.setAttribute("onclick", `import('../../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`);
|
||||
// import()s in an event handler are resolved relative to the document base.
|
||||
window.dummyDiv.setAttribute("onclick", `import('../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`);
|
||||
window.dummyDiv.click(); // different from **on**click()
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
window.dummyDiv.setAttribute("onclick", `import('../../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`);
|
||||
// import()s in an event handler are resolved relative to the document base.
|
||||
window.dummyDiv.setAttribute("onclick", `import('../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`);
|
||||
window.dummyDiv.onclick();
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
// import()s in a timeout handler are resolved relative to the script.
|
||||
setTimeout(`import('../../imports-a.js?label=' + window.label).then(window.continueTest, window.errorTest)`, 0);
|
||||
|
|
|
@ -37,7 +37,7 @@ function assertSuccessful(module) {
|
|||
promise_test(t => {
|
||||
const promise = createTestPromise(t);
|
||||
|
||||
setTimeout(`import('../imports-a.js?label=setTimeout').then(window.unreached, window.continueTest)`, 0);
|
||||
setTimeout(`import('../imports-a.js?label=setTimeout').then(window.continueTest, window.errorTest)`, 0);
|
||||
|
||||
return promise.then(assertSuccessful);
|
||||
}, "setTimeout must inherit the nonce from the triggering script, thus execute");
|
||||
|
@ -81,8 +81,8 @@ promise_test(t => {
|
|||
);
|
||||
dummyDiv.onclick();
|
||||
|
||||
return promise.then(assertSuccessful);
|
||||
}, "reflected inline event handlers must inherit the nonce from the triggering script, thus execute");
|
||||
return promise_rejects(t, new TypeError(), promise);
|
||||
}, "reflected inline event handlers must not inherit the nonce from the triggering script, thus fail");
|
||||
|
||||
promise_test(t => {
|
||||
t.add_cleanup(() => {
|
||||
|
@ -99,6 +99,6 @@ promise_test(t => {
|
|||
assert_equals(typeof dummyDiv.onclick, "function", "the browser must be able to parse a string containing the import() syntax into a function");
|
||||
dummyDiv.click(); // different from **on**click()
|
||||
|
||||
return promise.then(assertSuccessful);
|
||||
}, "inline event handlers triggered via UA code must inherit the nonce from the triggering script, thus execute");
|
||||
return promise_rejects(t, new TypeError(), promise);
|
||||
}, "inline event handlers triggered via UA code must not inherit the nonce from the triggering script, thus fail");
|
||||
</script>
|
||||
|
|
|
@ -36,7 +36,7 @@ function assertSuccessful(module) {
|
|||
promise_test(t => {
|
||||
const promise = createTestPromise(t);
|
||||
|
||||
setTimeout(`import('../imports-a.js?label=setTimeout').then(window.unreached, window.continueTest)`, 0);
|
||||
setTimeout(`import('../imports-a.js?label=setTimeout').then(window.continueTest, window.errorTest)`, 0);
|
||||
|
||||
return promise.then(assertSuccessful);
|
||||
}, "setTimeout must inherit the nonce from the triggering script, thus execute");
|
||||
|
@ -80,8 +80,8 @@ promise_test(t => {
|
|||
);
|
||||
dummyDiv.onclick();
|
||||
|
||||
return promise.then(assertSuccessful);
|
||||
}, "reflected inline event handlers must inherit the nonce from the triggering script, thus execute");
|
||||
return promise_rejects(t, new TypeError(), promise);
|
||||
}, "reflected inline event handlers must not inherit the nonce from the triggering script, thus fail");
|
||||
|
||||
promise_test(t => {
|
||||
t.add_cleanup(() => {
|
||||
|
@ -98,6 +98,6 @@ promise_test(t => {
|
|||
assert_equals(typeof dummyDiv.onclick, 'function', "the browser must be able to parse a string containing the import() syntax into a function");
|
||||
dummyDiv.click(); // different from **on**click()
|
||||
|
||||
return promise.then(assertSuccessful);
|
||||
}, "inline event handlers triggered via UA code must inherit the nonce from the triggering script, thus execute");
|
||||
return promise_rejects(t, new TypeError(), promise);
|
||||
}, "inline event handlers triggered via UA code must not inherit the nonce from the triggering script, thus fail");
|
||||
</script>
|
||||
|
|
|
@ -26,14 +26,6 @@ function startTest() {
|
|||
"the Function constructor"(x) {
|
||||
otherWindow.Function(x)();
|
||||
},
|
||||
"reflected inline event handlers"(x) {
|
||||
otherDiv.setAttribute("onclick", x);
|
||||
otherDiv.onclick();
|
||||
},
|
||||
"inline event handlers triggered by JS"(x) {
|
||||
otherDiv.setAttribute("onclick", x);
|
||||
otherDiv.click(); // different from .**on**click()
|
||||
}
|
||||
};
|
||||
|
||||
for (const [label, evaluator] of Object.entries(evaluators)) {
|
||||
|
@ -53,6 +45,35 @@ function startTest() {
|
|||
});
|
||||
}, label + " should successfully import");
|
||||
};
|
||||
|
||||
const eventHandlerEvaluators = {
|
||||
"reflected inline event handlers"(x) {
|
||||
otherDiv.setAttribute("onclick", x);
|
||||
otherDiv.onclick();
|
||||
},
|
||||
"inline event handlers triggered by JS"(x) {
|
||||
otherDiv.setAttribute("onclick", x);
|
||||
otherDiv.click(); // different from .**on**click()
|
||||
}
|
||||
};
|
||||
|
||||
for (const [label, evaluator] of Object.entries(eventHandlerEvaluators)) {
|
||||
promise_test(t => {
|
||||
t.add_cleanup(() => {
|
||||
otherDiv.removeAttribute("onclick");
|
||||
delete otherWindow.evaluated_imports_a;
|
||||
});
|
||||
|
||||
const promise = createTestPromise();
|
||||
|
||||
evaluator(`import('../../imports-a.js?label=${label}').then(window.continueTest, window.errorTest);`);
|
||||
|
||||
return promise.then(module => {
|
||||
assert_true(otherWindow.evaluated_imports_a, "The module must have been evaluated");
|
||||
assert_equals(module.A.from, "imports-a.js", "The module namespace object must be correct");
|
||||
});
|
||||
}, label + " should successfully import");
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<body onLoad="startTest()"></body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue