diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/long-animation-frame/tentative/loaf-script-block.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/long-animation-frame/tentative/loaf-script-block.html')
-rw-r--r-- | testing/web-platform/tests/long-animation-frame/tentative/loaf-script-block.html | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/testing/web-platform/tests/long-animation-frame/tentative/loaf-script-block.html b/testing/web-platform/tests/long-animation-frame/tentative/loaf-script-block.html new file mode 100644 index 0000000000..759b31f9a1 --- /dev/null +++ b/testing/web-platform/tests/long-animation-frame/tentative/loaf-script-block.html @@ -0,0 +1,77 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Long Animation Frame Timing: script blocks</title> +<meta name="timeout" content="long"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/utils.js"></script> +<script src="resources/utils.js"></script> +<script src="resources/busy.js?from-parser"></script> +<body> +<h1>Long Animation Frame: script blocks</h1> +<div id="log"></div> +<script> +promise_test(async t => { + await new Promise(resolve => { + new PerformanceObserver((list, observer) => { + if (list.getEntries().find(loaf => loaf.scripts.some(script => + script.invoker === new URL("resources/busy.js?from-parser", location.href).href))) { + observer.disconnect(); + resolve(); + } + }).observe({type: "long-animation-frame", buffered: true}); + }) +}, "Parser-inserted classic script should generate a long script"); + +test_self_script_block(t => { + const script = document.createElement("script"); + script.type = "module"; + script.innerHTML = `(${busy_wait.toString()})()`; + document.body.appendChild(script); +}, location.href, "module-script"); + +test_self_script_block(t => { + const script = document.createElement("script"); + script.src = "resources/busy.js"; + document.body.appendChild(script); +}, new URL("resources/busy.js", location.href).href, "classic-script"); + +test_self_script_block(t => { + const uid = token(); + const script = document.createElement("script"); + script.src = `resources/busy.js?token=${uid}`; + script.type = "module"; + document.body.appendChild(script); +}, new URL("resources/busy.js", location.href).href, "module-script"); + +test_self_script_block(t => { + const uid = token(); + const script = document.createElement("script"); + script.type = "module"; + script.innerHTML = `import("./resources/busy.js?import=${uid}");`; + document.body.appendChild(script); +}, new URL("resources/busy.js?import", location.href).href, "module-script"); + +const busy_wait_str = ` (function() { + const deadline = performance.now() + 365; + while (performance.now() < deadline) {} + })() +`; + +const data_url = `data:text/javascript;charset=utf-8,${encodeURIComponent(busy_wait_str)}`; + +test_self_script_block(t => { + const script = document.createElement("script"); + script.src = data_url; + document.body.appendChild(script); +}, "data:", "classic-script"); + +const blob_url = URL.createObjectURL(new Blob([busy_wait_str], {type: "text/javascript"})); + +test_self_script_block(t => { + const script = document.createElement("script"); + script.src = blob_url; + document.body.appendChild(script); +}, blob_url, "classic-script"); +</script> +</body> |