diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /testing/web-platform/tests/html/semantics/scripting-1 | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/scripting-1')
3 files changed, 75 insertions, 2 deletions
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/microtasks/basic.any.js b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/microtasks/basic.any.js index 82cb3b215d..4876e82b0d 100644 --- a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/microtasks/basic.any.js +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/dynamic-import/microtasks/basic.any.js @@ -25,8 +25,8 @@ promise_test(async t => { // Use Date.now() to ensure that the module is not in the module map const specifier = "./empty-module.js?" + Date.now(); - const getCount = ticker(1e7); + const getCount = ticker(1e6); await import(specifier); - assert_equals(getCount(), 1e7); + assert_equals(getCount(), 1e6); }, "import() should drain the microtask queue when fetching a new module"); diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/inline-async-inserted-execorder.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/inline-async-inserted-execorder.html new file mode 100644 index 0000000000..0f51fd318b --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/module/inline-async-inserted-execorder.html @@ -0,0 +1,70 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Inline async="" module scripts execute or throw parse errors asynchronously</title> +<link rel="help" href="https://github.com/whatwg/html/issues/9864"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<body> +<script> +"use strict"; +setup({ allow_uncaught_exception: true }); + +promise_test(async t => { + window.log = ["before any script execution"]; + + window.addEventListener("error", ev => { + window.log.push("error event on Window"); + }); + + const noErrorScript = document.createElement("script"); + noErrorScript.type = "module"; + noErrorScript.async = true; + noErrorScript.textContent = "window.log.push('no error script executed');"; + + // This should queue a task to run the script, but not run it immediately. + document.head.append(noErrorScript); + + log.push("after inserting noErrorScript"); + assert_array_equals(window.log, [ + "before any script execution", + "after inserting noErrorScript" + ]); + + const parseErrorScript = document.createElement("script"); + parseErrorScript.type = "module"; + parseErrorScript.async = true; + parseErrorScript.textContent = "+++++"; + + // This should queue a task to fire the error event, but not fire it immediately. + document.head.append(parseErrorScript); + + log.push("after inserting parseErrorScript"); + assert_array_equals(window.log, [ + "before any script execution", + "after inserting noErrorScript", + "after inserting parseErrorScript" + ]); + + // After a microtask, the script run / error event must not happen. + queueMicrotask(t.step_func(() => { + assert_array_equals(window.log, [ + "before any script execution", + "after inserting noErrorScript", + "after inserting parseErrorScript" + ]); + })); + + // But it must eventually happen, after a full task. + await t.step_wait(() => window.log.length == 5, "5 items must eventually be logged"); + + // And when it does the order must be correct. + assert_array_equals(window.log, [ + "before any script execution", + "after inserting noErrorScript", + "after inserting parseErrorScript", + "no error script executed", + "error event on Window" + ]); +}); +</script> diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-template-element/WEB_FEATURES.yml b/testing/web-platform/tests/html/semantics/scripting-1/the-template-element/WEB_FEATURES.yml new file mode 100644 index 0000000000..bd821885c7 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-template-element/WEB_FEATURES.yml @@ -0,0 +1,3 @@ +features: +- name: template + files: "**" |