summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html')
-rw-r--r--testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-meta-referrer-and-script-from-fragment.tentative.html54
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>