summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/html/semantics/scripting-1
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/mozilla/tests/html/semantics/scripting-1
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/mozilla/tests/html/semantics/scripting-1')
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module-circular.html25
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module-error.html25
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module.html25
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module-circular.html28
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module-error.html25
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module.html21
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/circular-module-import-with-syntax-error.html26
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/create-module-script.html25
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/mixed-content-import.https.html27
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/module-error-reporting.html89
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/reload-failed-module-script.html41
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module.js11
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module_circular.js5
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module_error.js5
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module.js14
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module_circular.js3
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module_error.js4
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module.js12
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_1.js3
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_2.js5
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_3.js8
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_failure.js6
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/bad_local_export.js3
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error1.js2
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error2.js1
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error3.js1
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/evaluation-order-setup.mjs19
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/import_resolve_failure.js2
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/indirect_export_resolve_failure.js2
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/missing_import.js2
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/missing_indirect_export.js2
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/mixed_import.js1
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/mixed_import2.js1
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/module.js2
-rw-r--r--testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/module_eval_error.js3
35 files changed, 474 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module-circular.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module-circular.html
new file mode 100644
index 0000000000..c99893a786
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module-circular.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Load dynamically imported async modules circular</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ var test = async_test("Load async dynamic module")
+ window.addEventListener("error", scriptError);
+ function scriptError(e) {
+ // An error is expected
+ test.step(() => assert_true(e.message !== "FAIL"));
+ }
+ function scriptLoaded() {
+ test.done();
+ }
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+</script>
+<script type="module"
+ src="./support/async_dynamic_module_circular.js"
+ onerror="testNoError()"
+ onload="scriptLoaded()"></script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module-error.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module-error.html
new file mode 100644
index 0000000000..ff2ac06222
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module-error.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Load dynamically imported async modules which errors</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ var test = async_test("Load dynamically imported async modules with error")
+ window.addEventListener("error", scriptError);
+ function scriptError(e) {
+ // An error is expected
+ test.step(() => assert_true(e.message !== "FAIL"));
+ }
+ function scriptLoaded() {
+ test.done();
+ }
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+</script>
+<script type="module"
+ src="./support/async_dynamic_module_error.js"
+ onerror="testNoError()"
+ onload="scriptLoaded()"></script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module.html
new file mode 100644
index 0000000000..2e1b267492
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-dynamic-module.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Load dynamically imported async modules</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ var test = async_test("Load async dynamic module")
+ window.addEventListener("error", scriptError);
+ function scriptError(e) {
+ // An error is expected
+ test.step(() => assert_true(e.message !== "FAIL"));
+ }
+ function scriptLoaded() {
+ test.done();
+ }
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+</script>
+<script type="module"
+ src="./support/async_dynamic_module.js"
+ onerror="testNoError()"
+ onload="scriptLoaded()"></script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module-circular.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module-circular.html
new file mode 100644
index 0000000000..7540ebb5ec
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module-circular.html
@@ -0,0 +1,28 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Load async modules circular</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ var test = async_test("Load async module")
+ window.addEventListener("error", scriptError);
+ function scriptError(e) {
+ // An error is expected
+ test.step(() => assert_true(e.message !== "FAIL"));
+ test.done();
+ }
+ function scriptLoaded() {
+ test.step(() => assert_unreached("Should not load before error"));
+ test.done();
+ }
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+</script>
+<script type="module"
+ src="./support/async_module_circular.js"
+ onerror="testNoError()"
+ onload="scriptLoaded()">
+</script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module-error.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module-error.html
new file mode 100644
index 0000000000..c720611080
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module-error.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Load an async module</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ var test = async_test("Load dynamic async module with syntax error")
+ window.addEventListener("error", scriptError);
+ function scriptError(e) {
+ // An error is expected
+ test.step(() => assert_true(e.message !== "FAIL"));
+ }
+ function scriptLoaded() {
+ test.done();
+ }
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+</script>
+<script type="module"
+ src="./support/async_module_error.js"
+ onerror="testNoError()"
+ onload="scriptLoaded()"></script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module.html
new file mode 100644
index 0000000000..566e2a379d
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/async-module.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Load dynamically imported async modules</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ var test = async_test("Load async dynamic module")
+ function scriptLoaded() {
+ test.done();
+ }
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+</script>
+<script type="module"
+ src="./support/async_module.js"
+ onerror="testNoError()"
+ onload="scriptLoaded()">
+</script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/circular-module-import-with-syntax-error.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/circular-module-import-with-syntax-error.html
new file mode 100644
index 0000000000..e472656e34
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/circular-module-import-with-syntax-error.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Load a module with circular imports and syntax error</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ var test = async_test("Load module with circular imports and syntax error")
+ window.addEventListener("error", scriptError);
+ function scriptError() {
+ // An error is expected
+ test.done();
+ }
+ function scriptLoaded() {
+ test.step(() => assert_unreached("Should not load"));
+ test.done();
+ }
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+</script>
+<script type="module"
+ src="./support/circular_error1.js"
+ onerror="testNoError()"
+ onload="scriptLoaded()"></script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/create-module-script.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/create-module-script.html
new file mode 100644
index 0000000000..44337a0217
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/create-module-script.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Insert non-async module script</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ var test = async_test("Create module script")
+ var moduleRan = false;
+ function loadModule() {
+ var script = document.createElement("script");
+ script.onerror = function() {
+ test.step(() => assert_unreached("Should not get an error"));
+ test.done();
+ };
+ script.onload = function() {
+ test.step(() => assert_equals(moduleRan, true));
+ test.done();
+ };
+ script.type = "module";
+ script.src = "support/module.js";
+ script.async = false;
+ document.documentElement.appendChild(script);
+ }
+</script>
+<body onload='loadModule()'></body>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/mixed-content-import.https.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/mixed-content-import.https.html
new file mode 100644
index 0000000000..5342bd525c
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/mixed-content-import.https.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Attempt to load a mixed content module graph</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+ var test = async_test("Attempt to load a mixed content module graph")
+ window.addEventListener("error", testNoError);
+ function scriptError() {
+ // An error is expected
+ test.done();
+ }
+ function scriptLoaded() {
+ test.step(() => assert_unreached("Should not load"));
+ test.done();
+ }
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+</script>
+<script type="module"
+ onerror="scriptError()"
+ onload="scriptLoaded()"
+ src="./support/mixed_import.js">
+</script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/module-error-reporting.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/module-error-reporting.html
new file mode 100644
index 0000000000..e4c43060b6
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/module-error-reporting.html
@@ -0,0 +1,89 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Insert non-async module script</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+
+ const test = async_test("Test error event properties");
+
+ let errorCount = 0;
+ let eventCount = 0;
+ window.addEventListener("error", handleError);
+ window.addEventListener("load", handleLoaded);
+
+ function handleEvent(event) {
+ eventCount++;
+ test.step(() => assert_equals(typeof event, "object"));
+ test.step(() => assert_true(event instanceof Event));
+ }
+
+ function handleError(event) {
+ errorCount++;
+ test.step(() => assert_equals(typeof event, "object"));
+ test.step(() => assert_true(event instanceof ErrorEvent));
+ switch (errorCount) {
+ case 1:
+ test.step(() => assert_true(event.error instanceof SyntaxError));
+ test.step(() => assert_true(event.filename.endsWith("/bad_local_export.js")));
+ test.step(() => assert_equals(event.lineno, 3));
+ test.step(() => assert_equals(event.colno, 7));
+ break;
+ case 2:
+ test.step(() => assert_true(event.error instanceof TypeError));
+ test.step(() => assert_true(event.filename.endsWith("/import_resolve_failure.js")));
+ test.step(() => assert_equals(event.lineno, 2));
+ test.step(() => assert_equals(event.colno, 16));
+ break;
+ case 3:
+ test.step(() => assert_true(event.error instanceof TypeError));
+ test.step(() => assert_true(event.filename.endsWith("/indirect_export_resolve_failure.js")));
+ test.step(() => assert_equals(event.lineno, 2));
+ test.step(() => assert_equals(event.colno, 19));
+ break;
+ case 4:
+ test.step(() => assert_true(event.error instanceof SyntaxError));
+ test.step(() => assert_true(event.filename.endsWith("/missing_import.js")));
+ test.step(() => assert_equals(event.lineno, 2));
+ test.step(() => assert_equals(event.colno, 8));
+ break;
+ case 5:
+ test.step(() => assert_true(event.error instanceof SyntaxError));
+ test.step(() => assert_true(event.filename.endsWith("/missing_indirect_export.js")));
+ test.step(() => assert_equals(event.lineno, 2));
+ test.step(() => assert_equals(event.colno, 11));
+ break;
+ case 6:
+ test.step(() => assert_true(event.error instanceof SyntaxError));
+ test.step(() => assert_true(event.filename.endsWith("/module_eval_error.js")));
+ test.step(() => assert_equals(event.lineno, 3));
+ test.step(() => assert_equals(event.colno, 0));
+ break;
+ }
+ }
+
+ function testNoError() {
+ test.step(() => assert_unreached("No event expected here"));
+ test.done();
+ }
+
+ function handleLoaded() {
+ test.step(() => assert_equals(eventCount, 2));
+ test.step(() => assert_equals(errorCount, 6));
+ test.done();
+ }
+
+</script>
+
+<!-- Errors that fire an event on the script element -->
+<script type="module" src="" onerror="handleEvent(event)"></script>
+<script type="module" src="./does_not_exist" onerror="handleEvent(event)"></script>
+
+<!-- Errors that fire an error event on the global -->
+<script type="module" src="./support/bad_local_export.js" onerror="handleEvent(event)"></script>
+<script type="module" src="./support/import_resolve_failure.js" onerror="testNoError()"></script>
+<script type="module" src="./support/indirect_export_resolve_failure.js" onerror="testNoError()"></script>
+<script type="module" src="./support/missing_import.js" onerror="testNoError()"></script>
+<script type="module" src="./support/missing_indirect_export.js" --onerror="testNoError()"></script>
+<script type="module" src="./support/module_eval_error.js" onerror="testNoError()"></script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/reload-failed-module-script.html b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/reload-failed-module-script.html
new file mode 100644
index 0000000000..b95d3fe330
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/reload-failed-module-script.html
@@ -0,0 +1,41 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Insert non-async module script</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+ setup({allow_uncaught_exception: true});
+
+ var test = async_test("Reload failed module script");
+
+ var errorCount = 0;
+ window.addEventListener("error", handleError);
+
+ function handleError() {
+ errorCount++;
+
+ if (errorCount == 1) {
+ reloadModule();
+ return;
+ }
+
+ test.step(() => assert_equals(errorCount, 2));
+ test.done();
+ }
+
+ function reloadModule() {
+ var script = document.createElement("script");
+ script.onerror = testNoError;
+ script.type = "module";
+ script.src = "support/missing_import.js";
+ script.async = false;
+ document.documentElement.appendChild(script);
+ }
+
+ function testNoError() {
+ test.step(() => assert_unreached("No event expect here"));
+ test.done();
+ }
+
+</script>
+<script type="module" src="support/missing_import.js" onerror="testNoError()"></script>
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module.js
new file mode 100644
index 0000000000..238dc11402
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module.js
@@ -0,0 +1,11 @@
+var ns = await import('./async_test_module.js');
+if (ns.default !== 42) {
+ throw new Error("FAIL");
+}
+if (ns.x !== "named") {
+ throw new Error("FAIL");
+}
+if (ns.y !== 39) {
+ throw new Error("FAIL");
+}
+
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module_circular.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module_circular.js
new file mode 100644
index 0000000000..93bfc3aca8
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module_circular.js
@@ -0,0 +1,5 @@
+try {
+ var ns = await import('./async_test_module_circular_1.js');
+} catch(ns) {
+ throw Error("Fails as expected");
+};
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module_error.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module_error.js
new file mode 100644
index 0000000000..3832960108
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_dynamic_module_error.js
@@ -0,0 +1,5 @@
+try {
+ await import('./bad_local_export.js');
+} catch(ns) {
+ throw Error("Fails as expected");
+};
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module.js
new file mode 100644
index 0000000000..34a590bcfc
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module.js
@@ -0,0 +1,14 @@
+import nsPromise from './async_test_module.js';
+
+console.log("hi");
+let ns = await nsPromise;
+
+if (ns.default !== 42) {
+ throw new Error("FAIL");
+}
+if (ns.x !== "named") {
+ throw new Error("FAIL");
+}
+if (ns.y !== 39) {
+ throw new Error("FAIL");
+}
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module_circular.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module_circular.js
new file mode 100644
index 0000000000..a9dff71b17
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module_circular.js
@@ -0,0 +1,3 @@
+import module from './async_test_module_circular_1.js';
+
+throw new Error("FAIL");
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module_error.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module_error.js
new file mode 100644
index 0000000000..3fa6991768
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_module_error.js
@@ -0,0 +1,4 @@
+import ns from "./async_test_module_failure.js";
+
+throw Error("FAIL");
+
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module.js
new file mode 100644
index 0000000000..201c76eedf
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module.js
@@ -0,0 +1,12 @@
+await 1;
+await 2;
+export default await Promise.resolve(42);
+
+export const y = await 39;
+export const x = await 'named';
+
+// Bonus: this rejection is not unwrapped
+if (false) {
+ await Promise.reject(42);
+}
+
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_1.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_1.js
new file mode 100644
index 0000000000..2fdf67baca
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_1.js
@@ -0,0 +1,3 @@
+import module from './async_test_module_circular_2.js';
+
+export default {};
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_2.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_2.js
new file mode 100644
index 0000000000..0a09aacc39
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_2.js
@@ -0,0 +1,5 @@
+import module from './async_test_module_circular_3.js';
+
+await module.test();
+
+export default {};
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_3.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_3.js
new file mode 100644
index 0000000000..d815bc00e4
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_circular_3.js
@@ -0,0 +1,8 @@
+import module from './async_test_module_circular_1.js';
+
+export default {
+ async test() {
+ throw new Error("error thrown");
+ return Promise.resolve()
+ }
+};
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_failure.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_failure.js
new file mode 100644
index 0000000000..6f823f3003
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/async_test_module_failure.js
@@ -0,0 +1,6 @@
+export default 42;
+
+export const named = 'named';
+
+var rejection = Promise.reject(TypeError('I reject this!'));
+await rejection;
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/bad_local_export.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/bad_local_export.js
new file mode 100644
index 0000000000..0b3df8de32
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/bad_local_export.js
@@ -0,0 +1,3 @@
+// Attempt to export something that doesn't exist.
+
+export missing;
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error1.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error1.js
new file mode 100644
index 0000000000..f0310fe0b1
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error1.js
@@ -0,0 +1,2 @@
+import { test2 } from "./circular_error2.js";
+import "./circular_error3.js";
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error2.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error2.js
new file mode 100644
index 0000000000..5b163eab93
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error2.js
@@ -0,0 +1 @@
+import "./circular_error3.js";
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error3.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error3.js
new file mode 100644
index 0000000000..2589defac8
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/circular_error3.js
@@ -0,0 +1 @@
+import "./circular_error1.js";
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/evaluation-order-setup.mjs b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/evaluation-order-setup.mjs
new file mode 100644
index 0000000000..d3f22e9ee0
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/evaluation-order-setup.mjs
@@ -0,0 +1,19 @@
+globalThis.setup({allow_uncaught_exception: true});
+
+globalThis.log = [];
+
+globalThis.addEventListener("error",
+ event => globalThis.log.push("global-error", event.error.message));
+globalThis.addEventListener("onunhandledrejection",
+ event => globalThis.log.push('unhandled-promise-rejection'));
+globalThis.addEventListener("load",
+ event => globalThis.log.push("global-load"));
+
+globalThis.unreachable = function() {
+ globalThis.log.push("unreachable");
+}
+
+globalThis.test_load = async_test("Test evaluation order of modules");
+globalThis.testDone = globalThis.test_load.step_func_done(() => {
+ assert_array_equals(globalThis.log, globalThis.expectedLog);
+});
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/import_resolve_failure.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/import_resolve_failure.js
new file mode 100644
index 0000000000..a2e2875f20
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/import_resolve_failure.js
@@ -0,0 +1,2 @@
+// Import from an unresolvable module specifier.
+import {x} from "unresolvable";
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/indirect_export_resolve_failure.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/indirect_export_resolve_failure.js
new file mode 100644
index 0000000000..282fd2ed62
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/indirect_export_resolve_failure.js
@@ -0,0 +1,2 @@
+// Export from an unresolvable module specifier.
+export {x, y} from "unresolvable";
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/missing_import.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/missing_import.js
new file mode 100644
index 0000000000..885db02dde
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/missing_import.js
@@ -0,0 +1,2 @@
+// Import a non-existent export to trigger instantiation failure.
+import {not_found} from "./module.js";
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/missing_indirect_export.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/missing_indirect_export.js
new file mode 100644
index 0000000000..8494031b09
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/missing_indirect_export.js
@@ -0,0 +1,2 @@
+// Import a non-existent export to trigger instantiation failure.
+export {x, not_found} from "./module.js";
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/mixed_import.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/mixed_import.js
new file mode 100644
index 0000000000..371018f1f4
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/mixed_import.js
@@ -0,0 +1 @@
+export * from "http://web-platform.test:8000/_mozilla/html/semantics/scripting-1/the-script-element/support/mixed_import2.js"
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/mixed_import2.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/mixed_import2.js
new file mode 100644
index 0000000000..60c6c8d8b0
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/mixed_import2.js
@@ -0,0 +1 @@
+export default "foo";
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/module.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/module.js
new file mode 100644
index 0000000000..1269686475
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/module.js
@@ -0,0 +1,2 @@
+export let x = 42;
+moduleRan = true;
diff --git a/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/module_eval_error.js b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/module_eval_error.js
new file mode 100644
index 0000000000..3bd872b2e6
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/html/semantics/scripting-1/the-script-element/support/module_eval_error.js
@@ -0,0 +1,3 @@
+// A module that throws when evaluated.
+
+this = 0;