diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /testing/web-platform/tests/dom/nodes/insertion-removing-steps | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/insertion-removing-steps')
-rw-r--r-- | testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html index d247797603..e80e3b45b6 100644 --- a/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html +++ b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html @@ -5,25 +5,37 @@ <script src=/resources/testharnessreport.js></script> <script> promise_test(async t => { - const script = document.createElement("script"); - const meta = document.createElement("meta"); - meta.name = "referrer"; - meta.content = "no-referrer"; - const fragment = new DocumentFragment(); - const done = new Promise(resolve => { - window.didFetch = resolve; - }); - script.textContent = ` - (async function() { - const response = await fetch("/html/infrastructure/urls/terminology-0/resources/echo-referrer-text.py") - const text = await response.text(); - window.didFetch(text); - })(); - `; - fragment.append(script, meta); - document.head.append(fragment); - const result = await done; - assert_equals(result, ""); -}, "<meta name=referrer> should apply before script, as it is an insertion step " + - "and not a post-insertion step"); + const preMetaScript = document.createElement("script"); + preMetaScript.textContent = ` + window.preMetaScriptPromise = fetch('/html/infrastructure/urls/terminology-0/resources/echo-referrer-text.py') + .then(response => response.text()); + `; + + const meta = document.createElement("meta"); + meta.name = "referrer"; + meta.content = "no-referrer"; + + const postMetaScript = document.createElement("script"); + postMetaScript.textContent = ` + window.postMetaScriptPromise = fetch('/html/infrastructure/urls/terminology-0/resources/echo-referrer-text.py') + .then(response => response.text()); + `; + + const fragment = new DocumentFragment(); + fragment.append(preMetaScript, meta, postMetaScript); + document.head.append(fragment); + + const preMetaReferrer = await window.preMetaScriptPromise; + assert_equals(preMetaReferrer, location.href, + "preMetaReferrer is the full URL; by the time the first script runs in " + + "its post-insertion steps, the later-inserted meta tag has not run its " + + "post-insertion steps, which is where meta tags are processed"); + + const postMetaReferrer = await window.postMetaScriptPromise; + assert_equals(postMetaReferrer, "", + "postMetaReferrer is empty; by the time the second script runs in " + + "its post-insertion steps, the later-inserted meta tag has run its " + + "post-insertion steps, and observes the meta tag's effect"); +}, "<meta name=referrer> gets processed and applied in the post-insertion " + + "steps"); </script> |