Update web-platform-tests to revision 71e901cf4534417abfabe4d77a317817f5cc09db

This commit is contained in:
WPT Sync Bot 2019-01-03 20:37:31 -05:00
parent 7c34a70ca8
commit 0bc27d4696
48 changed files with 1125 additions and 147 deletions

View file

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<div id="dummy"></div>
</body>
</html>

View file

@ -0,0 +1,58 @@
<!doctype html>
<meta charset=utf-8>
<title>Check import() works when active script is in another document</title>
<link rel="author" title="Jon Coppeard" href="mailto:jcoppeard@mozilla.com">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe id="frame" src="resources/empty-iframe.html"></iframe>
<script>
function startTest() {
const otherWindow = document.getElementById("frame").contentWindow;
const otherDiv = otherWindow.document.getElementById("dummy");
function createTestPromise() {
return new Promise((resolve, reject) => {
otherWindow.continueTest = resolve;
otherWindow.errorTest = reject;
});
}
const evaluators = {
eval: otherWindow.eval,
setTimeout: otherWindow.setTimeout,
"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)) {
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>