diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/scripting-1/the-script-element/moving-between-documents/ordering/in-order.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/scripting-1/the-script-element/moving-between-documents/ordering/in-order.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/moving-between-documents/ordering/in-order.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/moving-between-documents/ordering/in-order.html new file mode 100644 index 0000000000..6a3e2b54a7 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/moving-between-documents/ordering/in-order.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<link rel="help" href="https://html.spec.whatwg.org/C/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="helper.js"></script> +<body> +<script> +const t = async_test('Script elements (in-order) still block subsequent in-order scripts in the original Document after moved to another Document'); +const start_time = performance.now(); +const iframe = document.createElement('iframe'); +document.body.appendChild(iframe); + +const onScript2Evaluated = t.step_func_done(() => { + // `script1` should remain the + // #list-of-scripts-that-will-execute-in-order-as-soon-as-possible of the + // original Document and thus blocks `script2` evaluation until it is loaded. + assert_greater_than(performance.now() - start_time, 2000, + 'In-order scripts should block subsequent in-order scripts'); +}); + +const script1 = document.createElement('script'); +script1.async = false; +script1.setAttribute('src', '../../resources/throw.js?pipe=trickle(d2)'); +document.body.appendChild(script1); + +const script2 = document.createElement('script'); +script2.async = false; +script2.setAttribute('src', 'data:text/javascript,onScript2Evaluated()'); +document.body.appendChild(script2); + +t.step_timeout(() => { + iframe.contentDocument.body.appendChild(script1); +}, 1000); +</script> |