mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Update web-platform-tests to revision 7a767a52741f628430ffbbed46e7f3df68ba3534
Fixes #15648.
This commit is contained in:
parent
a1e4c547f0
commit
4fadf9b0b6
1184 changed files with 22551 additions and 9856 deletions
|
@ -1,23 +1,31 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>data URL and scripts</title>
|
||||
<title>Test data URL and scripts errors</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception:true})
|
||||
async_test(t => {
|
||||
setup({allow_uncaught_exception:true});
|
||||
async_test(function(t) {
|
||||
var counter = 1
|
||||
window.onerror = t.step_func((message, x, xx, xxx, e) => {
|
||||
assert_not_equals(message, "Script error.") // Cannot be "muted" as data URLs are same-origin
|
||||
window.onerror = t.step_func((message, url, lineno, colno, e) => {
|
||||
// Test that error is not muted as data URLs have a response type of "default"
|
||||
// and errors should only be muted if the response type is "opaque" or "opaqueredirect"
|
||||
assert_not_equals(message, "Script error.")
|
||||
assert_not_equals(url, null);
|
||||
assert_not_equals(url, "");
|
||||
assert_equals(typeof lineno, "number");
|
||||
assert_not_equals(lineno, 0);
|
||||
assert_equals(typeof colno, "number");
|
||||
assert_not_equals(colno, 0);
|
||||
assert_equals(typeof e, "number")
|
||||
assert_equals(e, counter)
|
||||
if (counter == 3) {
|
||||
t.done()
|
||||
}
|
||||
counter++
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script src="data:,throw 1"></script>
|
||||
<script src="data:,throw 2" crossorigin></script>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
document._log = [];
|
||||
window.addEventListener("error", function (ev) {
|
||||
var errorSerialized = ev.lineno + "-" + ev.colno;
|
||||
document._log.push(errorSerialized);
|
||||
});
|
||||
window.addEventListener("load", function () {
|
||||
document._log = document._log.join(",");
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin-import-NoCORS</title>
|
||||
<script src="crossorigin-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin-import-NoCORS</h1>
|
||||
<script type="module">
|
||||
|
||||
import { foo } from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/crossorigin-scripterror.js";
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin-root-BlockedMissingHeader</title>
|
||||
<script src="crossorigin-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin-root-BlockedMissingHeader</h1>
|
||||
<script type="module" onerror="document._log.push('error');" crossorigin>
|
||||
|
||||
import { foo } from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/crossorigin-scripterror.js";
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin-root-WithCORS</title>
|
||||
<script src="crossorigin-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin-root-WithCORS</h1>
|
||||
<script type="module" crossorigin>
|
||||
|
||||
import { foo } from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/crossorigin-scripterror.js?pipe=header(Access-Control-Allow-Origin,*)";
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin-root-BlockedWrongHeader</title>
|
||||
<script src="crossorigin-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin-root-BlockedWrongHeader</h1>
|
||||
<script type="module" onerror="document._log.push('error');" crossorigin>
|
||||
|
||||
import { foo } from "http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/crossorigin-scripterror.js?pipe=header(Access-Control-Allow-Origin,http://{{domains[www2]}}:{{ports[http][0]}})";
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin-root-NoCORS</title>
|
||||
<script src="crossorigin-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin-root-NoCORS</h1>
|
||||
<script type="module" src="http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/crossorigin-scripterror.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin-root-BlockedMissingHeader</title>
|
||||
<script src="crossorigin-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin-root-BlockedMissingHeader</h1>
|
||||
<script type="module" src="http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/crossorigin-scripterror.js" onerror="document._log.push('error');" crossorigin></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin-root-WithCORS</title>
|
||||
<script src="crossorigin-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin-root-WithCORS</h1>
|
||||
<script type="module" src="http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/crossorigin-scripterror.js?pipe=header(Access-Control-Allow-Origin,*)" crossorigin></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin-root-BlockedWrongHeader</title>
|
||||
<script src="crossorigin-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin-root-BlockedWrongHeader</h1>
|
||||
<script type="module" src="http://{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/module/crossorigin-scripterror.js?pipe=header(Access-Control-Allow-Origin,http://{{domains[www2]}}:{{ports[http][0]}})" onerror="document._log.push('error');" crossorigin></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
export var foo = {};
|
||||
|
||||
// Push an event to the log indicating that the script was executed.
|
||||
document._log.push("running");
|
||||
|
||||
// Deliberately trigger an error to test what details of the error
|
||||
// the (possibly) cross-origin parent can listen to.
|
||||
nonExistentMethod();
|
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-crossOrigin</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-crossOrigin</h1>
|
||||
<iframe id="root-NoCORS" src="crossorigin-root-different.sub.html"></iframe>
|
||||
<iframe id="root-WithCORS" src="crossorigin-root-same.sub.html"></iframe>
|
||||
<iframe id="root-BlockedMissingHeader" src="crossorigin-root-missingheader.sub.html"></iframe>
|
||||
<iframe id="root-BlockedWrongHeader" src="crossorigin-root-wrongheader.sub.html"></iframe>
|
||||
<iframe id="import-NoCORS" src="crossorigin-import-different.sub.html"></iframe>
|
||||
<iframe id="import-WithCORS" src="crossorigin-import-same.sub.html"></iframe>
|
||||
<iframe id="import-BlockedMissingHeader" src="crossorigin-import-missingheader.sub.html"></iframe>
|
||||
<iframe id="import-BlockedWrongHeader" src="crossorigin-import-wrongheader.sub.html"></iframe>
|
||||
<script>
|
||||
|
||||
var tests = [
|
||||
{ "obj": async_test("Root module, Error in CORS-different-origin script"), "id": "root-NoCORS", "expected": "running,0-0" },
|
||||
{ "obj": async_test("Root module, Error in CORS-same-origin script"), "id": "root-WithCORS", "expected": "running,8-1" },
|
||||
{ "obj": async_test("Root module, Blocked script download, missing CORS ACAO header"), "id": "root-BlockedMissingHeader", "expected": "error" },
|
||||
{ "obj": async_test("Root module, Blocked script download, mismatched CORS ACAO header"), "id": "root-BlockedWrongHeader", "expected": "error" },
|
||||
{ "obj": async_test("Imported module, Error in CORS-different-origin script"), "id": "import-NoCORS", "expected": "running,0-0" },
|
||||
{ "obj": async_test("Imported module, Error in CORS-same-origin script"), "id": "import-WithCORS", "expected": "running,8-1" },
|
||||
{ "obj": async_test("Imported module, Blocked script download, missing CORS ACAO header"), "id": "import-BlockedMissingHeader", "expected": "error" },
|
||||
{ "obj": async_test("Imported module, Blocked script download, mismatched CORS ACAO header"), "id": "import-BlockedWrongHeader", "expected": "error" },
|
||||
];
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
tests.forEach(function (test) {
|
||||
var target = document.getElementById(test.id);
|
||||
test.obj.step(function () {
|
||||
assert_equals(target.contentDocument._log, test.expected, "Unexpected _log value");
|
||||
});
|
||||
test.obj.done();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,10 @@
|
|||
function errorHandler(ev)
|
||||
{
|
||||
document._errorReported.push("error");
|
||||
}
|
||||
|
||||
document._errorReported = [];
|
||||
window.addEventListener("error", errorHandler);
|
||||
window.addEventListener("load", function () {
|
||||
document._errorReported = document._errorReported.join(",");
|
||||
});
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-errorHandling-parseError-Dependent</title>
|
||||
<script src="errorhandling-parseerror-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module" onerror="errorHandler(event);">
|
||||
|
||||
// No parse errors in the root module, just in the dependent module
|
||||
import test from "./errorhandling-parseerror-dependent.js";
|
||||
document._errorReported = "shouldn't have run dependent module";
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
// Parse error in a dependent module
|
||||
1A
|
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-errorHandling-parseError-DependentMultiple</title>
|
||||
<script src="errorhandling-parseerror-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module" onerror="errorHandler(event);createSecondDependentRoot();">
|
||||
|
||||
// No parse errors in the root module, just in the dependent module
|
||||
import test from "./errorhandling-parseerror-dependentmultiple.js";
|
||||
document._errorReported = "shouldn't have run dependent module";
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
function createSecondDependentRoot()
|
||||
{
|
||||
// With the broken dependent module already acquired, try to import it
|
||||
// again from another root. This root should be unwound appropriately.
|
||||
var script = document.createElement("script");
|
||||
script.type = "module";
|
||||
script.textContent = "import test from './errorhandling-parseerror-dependentmultiple.js';" +
|
||||
"document._errorReported = 'really shouldn\\'t have run dependent module';";
|
||||
script.addEventListener("error", errorHandler);
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
// Parse error in a dependent module
|
||||
1A
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-errorHandling-parseError-Root</title>
|
||||
<script src="errorhandling-parseerror-common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="module">
|
||||
|
||||
// Parse error in a root module
|
||||
1A
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
import foo from "./errorhandling-wrongMimetype.js?pipe=header(X-Content-Type-Options,nosniff),header(Content-Type,text/plain)";
|
||||
|
||||
// We don't expect this code to run, the import above should fail!
|
||||
// If we do run though, don't trigger an error that the testharness
|
||||
// might misinterpret as the import itself failing to load.
|
||||
|
||||
var A = null;
|
||||
export { A };
|
|
@ -0,0 +1,7 @@
|
|||
// This is a plain JavaScript file, but since it will only be accessed with
|
||||
// a Content-Type of text/plain and nosniff, it will be seen as invalid.
|
||||
// The file itself will have no errors/effects, so if it does actually run,
|
||||
// no error will be detected, and the test will fail.
|
||||
|
||||
var foo = null;
|
||||
export foo;
|
|
@ -0,0 +1,61 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-errorHandling</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
|
||||
iframe
|
||||
{ display: none; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-errorHandling</h1>
|
||||
<iframe id="iframe_parseError_Root" src="errorhandling-parseerror-root.html"></iframe>
|
||||
<iframe id="iframe_parseError_Dependent" src="errorhandling-parseerror-dependent.html"></iframe>
|
||||
<iframe id="iframe_parseError_DependentMultiple" src="errorhandling-parseerror-dependentmultiple.html"></iframe>
|
||||
<script>
|
||||
|
||||
var tests = [
|
||||
{ "id": "iframe_parseError_Root", "expected": "error" },
|
||||
{ "id": "iframe_parseError_Dependent", "expected": "error" },
|
||||
{ "id": "iframe_parseError_DependentMultiple", "expected": "error,error" },
|
||||
];
|
||||
tests.forEach(function (testObj) {
|
||||
var testHandle = async_test("IFrame test: '" + testObj.id + "'");
|
||||
var testTarget = document.getElementById(testObj.id);
|
||||
testTarget.addEventListener("load", testHandle.step_func(function () {
|
||||
assert_equals(testTarget.contentDocument._errorReported, testObj.expected, "Unexpected _errorReported value");
|
||||
testHandle.done();
|
||||
}));
|
||||
});
|
||||
|
||||
var test_wrongMimetype_root = async_test("External root module with non-script mimetype");
|
||||
var script_wrongMimetype_root = document.createElement("script");
|
||||
script_wrongMimetype_root.type = "module";
|
||||
script_wrongMimetype_root.src = "errorhandling-wrongMimetype.js?pipe=header(Content-Type,text/plain),header(X-Content-Type-Options,nosniff)";
|
||||
script_wrongMimetype_root.addEventListener("error", test_wrongMimetype_root.step_func(function () {
|
||||
test_wrongMimetype_root.done();
|
||||
}));
|
||||
script_wrongMimetype_root.addEventListener("load", test_wrongMimetype_root.step_func(function () {
|
||||
assert_unreached("This script should not have loaded!");
|
||||
}));
|
||||
document.body.appendChild(script_wrongMimetype_root);
|
||||
|
||||
var test_wrongMimetype_import = async_test("Module with imported non-script mimetype");
|
||||
var script_wrongMimetype_import = document.createElement("script");
|
||||
script_wrongMimetype_import.type = "module";
|
||||
script_wrongMimetype_import.src = "errorhandling-wrongMimetype-import.js";
|
||||
script_wrongMimetype_import.addEventListener("error", test_wrongMimetype_import.step_func(function () {
|
||||
test_wrongMimetype_import.done();
|
||||
}));
|
||||
script_wrongMimetype_import.addEventListener("load", test_wrongMimetype_import.step_func(function () {
|
||||
assert_unreached("This script should not have loaded!");
|
||||
}));
|
||||
document.body.appendChild(script_wrongMimetype_import);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
test_dynamicOrdered.step(function() {
|
||||
assert_execCount(1, 2, "External script element (#1) should have fired second");
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
test_dynamicOrdered.step(function() {
|
||||
assert_execCount(1, 3, "External script element (#2) should have fired third");
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
test_dynamicOrdered.step(function() {
|
||||
assert_execCount(1, 4, "External script element (#3) should have fired fourth");
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
test_dynamicUnordered1.step(function() {
|
||||
test_dynamicUnordered1.done();
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
test_dynamicUnordered2.step(function() {
|
||||
test_dynamicUnordered2.done();
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
test_parsedOrdered.step(function() {
|
||||
assert_execCount(0, 2, "External deferred (#1) script element should have fired second");
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
test_parsedOrdered.step(function() {
|
||||
assert_execCount(0, 4, "External deferred (#2) script element should have fired fourth");
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
test_parsedUnordered1.step(function() {
|
||||
test_parsedUnordered1.done();
|
||||
});
|
|
@ -0,0 +1,3 @@
|
|||
test_parsedUnordered2.step(function() {
|
||||
test_parsedUnordered2.done();
|
||||
});
|
|
@ -0,0 +1,105 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-execOrder</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
var execCounts = [
|
||||
0, // test_parsedOrdered
|
||||
0, // test_dynamicOrdered
|
||||
];
|
||||
function assert_execCount(set, expected, description)
|
||||
{
|
||||
if (!execCounts[set])
|
||||
{
|
||||
execCounts[set] = 0;
|
||||
}
|
||||
assert_equals(++execCounts[set], expected, description);
|
||||
}
|
||||
|
||||
function create_script(src, opts)
|
||||
{
|
||||
var element = document.createElement("script");
|
||||
element.src = src;
|
||||
element.async = (opts.asyncOrdered ? false : true);
|
||||
element.type = (opts.module ? "module" : "text/javascript");
|
||||
document.body.appendChild(element);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-execOrder</h1>
|
||||
<script>
|
||||
|
||||
/////
|
||||
// Start test_parsedUnordered*
|
||||
/////
|
||||
var test_parsedUnordered1 = async_test("Unordered module script execution (parsed, unordered #1)");
|
||||
var test_parsedUnordered2 = async_test("Unordered module script execution (parsed, unordered #2)");
|
||||
</script>
|
||||
<script type="module" src="execOrder-parsedUnordered1.js"></script>
|
||||
<script type="module" src="execOrder-parsedUnordered2.js"></script>
|
||||
<script>
|
||||
/////
|
||||
// End test_parsedUnordered*
|
||||
/////
|
||||
|
||||
/////
|
||||
// Start test_dynamicUnordered*
|
||||
/////
|
||||
var test_dynamicUnordered1 = async_test("Unordered module script execution (dynamic, unordered #1)");
|
||||
var test_dynamicUnordered2 = async_test("Unordered module script execution (dynamic, unordered #2)");
|
||||
create_script("execOrder-dynamicUnordered1.js", { module: true });
|
||||
create_script("execOrder-dynamicUnordered2.js", { module: true });
|
||||
/////
|
||||
// End test_dynamicUnordered*
|
||||
/////
|
||||
|
||||
/////
|
||||
// Begin test_parsedOrdered
|
||||
/////
|
||||
var test_parsedOrdered = async_test("Interlaced module/non-module script execution (parsed, async-ordered)");
|
||||
window.addEventListener("load", test_parsedOrdered.step_func(function() {
|
||||
assert_execCount(0, 5, "onload should have fired fifth");
|
||||
test_parsedOrdered.done();
|
||||
}));
|
||||
</script>
|
||||
<script src="execOrder-parsedOrdered2.js" defer></script>
|
||||
<script type="module">
|
||||
test_parsedOrdered.step(function() {
|
||||
assert_execCount(0, 3, "Inline module-typed script element should have fired third");
|
||||
});
|
||||
</script>
|
||||
<script src="execOrder-parsedOrdered4.js" defer></script>
|
||||
<script>
|
||||
test_parsedOrdered.step(function() {
|
||||
assert_execCount(0, 1, "Inline untyped script element should have fired first");
|
||||
});
|
||||
/////
|
||||
// End test_parsedOrdered
|
||||
/////
|
||||
|
||||
/////
|
||||
// Start test_dynamicOrdered
|
||||
/////
|
||||
var test_dynamicOrdered = async_test("Interlaced module/non-module script execution (dynamic, async-ordered)");
|
||||
window.addEventListener("load", test_dynamicOrdered.step_func(function() {
|
||||
assert_execCount(1, 5, "onload should have fired fifth (last)");
|
||||
test_dynamicOrdered.done();
|
||||
}));
|
||||
create_script("execOrder-dynamicOrdered2.js", { asyncOrdered: true, module: false });
|
||||
create_script("execOrder-dynamicOrdered3.js", { asyncOrdered: true, module: true });
|
||||
create_script("execOrder-dynamicOrdered4.js", { asyncOrdered: true, module: false });
|
||||
test_dynamicOrdered.step(function() {
|
||||
assert_execCount(1, 1, "Inline untyped script element should have fired first");
|
||||
});
|
||||
/////
|
||||
// End test_dynamicOrdered
|
||||
/////
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,2 @@
|
|||
var A = { "from": "imports-a.js" };
|
||||
export { A };
|
|
@ -0,0 +1 @@
|
|||
export var B = { "from": "imports-b.js" };
|
|
@ -0,0 +1,2 @@
|
|||
import { CycleB } from "./imports-cycle-b.js";
|
||||
export var CycleA = "CycleA";
|
|
@ -0,0 +1,2 @@
|
|||
import { CycleA } from "./imports-cycle-a.js";
|
||||
export var CycleB = "CycleB";
|
|
@ -0,0 +1,5 @@
|
|||
import { CycleA } from "./imports-cycle-a.js";
|
||||
|
||||
test_importCycle.step(function () {
|
||||
assert_unreached("This module should not have loaded!");
|
||||
});
|
|
@ -0,0 +1,2 @@
|
|||
import { A } from "./imports-a.js";
|
||||
export { A as INC_A };
|
|
@ -0,0 +1,5 @@
|
|||
import { A } from "./imports-a.js";
|
||||
export { A as INC_AB_A };
|
||||
|
||||
import { B } from "./imports-b.js";
|
||||
export { B as INC_AB_B };
|
|
@ -0,0 +1,2 @@
|
|||
import { B } from "./imports-b.js";
|
||||
export { B as INC_B };
|
|
@ -0,0 +1,2 @@
|
|||
import { SelfInner as SelfInnerA } from "./imports-self-inner.js";
|
||||
export var SelfInner = "SelfInner";
|
|
@ -0,0 +1,5 @@
|
|||
import { SelfInner } from "./imports-self-inner.js";
|
||||
|
||||
test_importSelf.step(function () {
|
||||
assert_unreached("This module should not have loaded!");
|
||||
});
|
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>html-script-module-imports</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>html-script-module-imports</h1>
|
||||
|
||||
<script type="module">
|
||||
|
||||
import { A } from "./imports-a.js";
|
||||
|
||||
test(function () {
|
||||
assert_equals(A.from, "imports-a.js", "Unexpected A");
|
||||
}, "Import a simple module");
|
||||
|
||||
</script>
|
||||
<script type="module">
|
||||
|
||||
import { B as B_RENAMED } from "./imports-b.js";
|
||||
|
||||
test(function () {
|
||||
assert_equals(B_RENAMED.from, "imports-b.js", "Unexpected B_RENAMED");
|
||||
|
||||
try
|
||||
{
|
||||
B;
|
||||
assert_unreached("Unexpectedly defined B");
|
||||
}
|
||||
catch (ex)
|
||||
{}
|
||||
}, "Import a simple module, renamed");
|
||||
|
||||
</script>
|
||||
<script type="module">
|
||||
|
||||
import { INC_A } from "./imports-inc-a.js";
|
||||
import { INC_B } from "./imports-inc-b.js";
|
||||
import { INC_AB_A, INC_AB_B } from "./imports-inc-ab.js";
|
||||
|
||||
test(function () {
|
||||
assert_equals(INC_A.from, "imports-a.js", "Unexpected INC_A");
|
||||
assert_equals(INC_B.from, "imports-b.js", "Unexpected INC_A");
|
||||
assert_equals(INC_AB_A.from, "imports-a.js", "Unexpected INC_A");
|
||||
assert_equals(INC_AB_B.from, "imports-b.js", "Unexpected INC_A");
|
||||
assert_equals(INC_A, INC_AB_A, "INC_A and INC_AB_A should be the same");
|
||||
assert_equals(INC_B, INC_AB_B, "INC_B and INC_AB_B should be the same");
|
||||
}, "Import the same module multiple times");
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var test_importSelf = async_test("Import a module that tries to import itself");
|
||||
</script>
|
||||
<script type="module" src="imports-self.js" onerror="test_importSelf.done();"></script>
|
||||
|
||||
<script>
|
||||
var test_importCycle = async_test("Import a module with a cyclical module dependency");
|
||||
</script>
|
||||
<script type="module" src="imports-cycle.js" onerror="test_importCycle.done();"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue