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/html/browsers/browsing-the-web/navigating-across-documents/source | |
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/html/browsers/browsing-the-web/navigating-across-documents/source')
8 files changed, 130 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent-then-fragment.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent-then-fragment.html new file mode 100644 index 0000000000..d01ef4c77a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent-then-fragment.html @@ -0,0 +1,36 @@ +<!doctype html> +<meta charset=utf-8> +<title> + Set location from a parent, then do a fragment navigation from within the + frame. +</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<iframe></iframe> +<script> + promise_test(async test => { + // Wait for the DOM to be ready before inserting an <iframe> into it. + await new Promise(resolve => { onload = resolve }); + // Insert an <iframe> and wait for a dummy document to be loaded into it. + let iframe = document.createElement("iframe"); + iframe.src = "support/dummy.html"; + let iframe_loaded = new Promise(resolve => { iframe.onload = resolve }); + document.body.appendChild(iframe); + await iframe_loaded; + // The referrer is the main frame's URL since it initiated the iframe + // creation. + assert_equals(iframe.contentDocument.referrer, document.URL); + // Do a fragment navigation from the frame, which will fire the + // 'hashchange' function. + let hash_changed = new Promise(resolve => { + iframe.contentWindow.onhashchange = resolve + }); + let navigateScript = iframe.contentDocument.createElement("script"); + navigateScript.innerHTML = "location.href = '#foo'"; + iframe.contentDocument.body.appendChild(navigateScript); + await hash_changed; + // The referrer stays the same, even when the last navigation was + // initiated by the iframe (instead of the main frame document). + assert_equals(iframe.contentDocument.referrer, document.URL); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html new file mode 100644 index 0000000000..2efc3a6b4a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html @@ -0,0 +1,18 @@ +<!doctype html> +<meta charset=utf-8> +<title>Set location from a parent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<iframe></iframe> +<script> + setup({ single_test: true }); + onload = function() { + var fr = document.querySelector("iframe") + fr.contentWindow.location = "support/dummy.html" + fr.onload = function() { + assert_equals(fr.contentDocument.referrer, document.URL) + done() + } + } +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html new file mode 100644 index 0000000000..e21260cd35 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html @@ -0,0 +1,18 @@ +<!doctype html> +<meta charset=utf-8> +<title>Set src from a function called from a parent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<iframe src="support/set-parent-src.html"></iframe> +<script> +async_test(function() { + onload = this.step_func(function() { + var fr = document.querySelector("iframe") + fr.contentWindow.go() + fr.onload = this.step_func_done(function() { + assert_equals(fr.contentDocument.referrer, document.URL) + }) + }) +}) +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html new file mode 100644 index 0000000000..c6fa765b89 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html @@ -0,0 +1,19 @@ +<!doctype html> +<meta charset=utf-8> +<title>Set location from a function called from a parent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<iframe src="support/location-set.html"></iframe> +<script> +async_test(function() { + onload = this.step_func(function() { + var fr = document.querySelector("iframe") + var url = fr.contentDocument.URL + fr.contentWindow.go() + fr.onload = this.step_func_done(function() { + assert_equals(fr.contentDocument.referrer, url) + }) + }) +}) +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html new file mode 100644 index 0000000000..479019d847 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html @@ -0,0 +1,20 @@ +<!doctype html> +<meta charset=utf-8> +<title>Set the src attribute to about:blank and check referrer</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<iframe></iframe> +<script> + setup({ + single_test: true + }); + onload = function() { + var fr = document.querySelector("iframe") + fr.src = "about:blank" + fr.onload = function() { + assert_equals(fr.contentDocument.referrer, document.location.origin + '/') + done() + } + } +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html new file mode 100644 index 0000000000..0638657093 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html @@ -0,0 +1,3 @@ +<!doctype html> +<meta charset=utf-8> +<p>Hello.
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html new file mode 100644 index 0000000000..ad733afac3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<script> + function go() { + location.href = "support/dummy.html" + } +</script> +<p>Hello. Go.
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html new file mode 100644 index 0000000000..9d45be8c8d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<script> + function go() { + frameElement.src = "support/dummy.html" + } +</script> +<p>Hello. Go.
\ No newline at end of file |