summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-location.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-location.html')
-rw-r--r--testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-location.html27
1 files changed, 27 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-location.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-location.html
new file mode 100644
index 0000000000..fae17dd2ac
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/multiple-globals/context-for-location.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/context-helper.js"></script>
+<script>
+window.scriptToRun = 'relevantWindow.location = "target.html";';
+
+async_test(t => {
+ window.addEventListener("message", t.step_func_done(function(e) {
+ // Base URL used for parsing a relative URL to `target.html`
+ // should be the base URL of the entry settings object in
+ // https://html.spec.whatwg.org/C/#dom-location-assign
+ assert_equals(
+ e.data.location,
+ new URL('target.html', entryUrl).href,
+ 'Base URL should use the entry settings object');
+
+ // `document.referrer` should reflect the source browsing context,
+ // which is the incumbent in
+ // https://html.spec.whatwg.org/C/#location-object-navigate
+ assert_equals(
+ e.data.referrer, incumbentUrl,
+ 'Referrer should use the incumbent settings object');
+ }));
+}, 'Fetch client and URL resolution for location setter');
+</script>
+<iframe id="entry" src="entry/entry.html"></iframe>