summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/infrastructure/urls/base-url/matches-about-blank-base-url.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/infrastructure/urls/base-url/matches-about-blank-base-url.window.js')
-rw-r--r--testing/web-platform/tests/html/infrastructure/urls/base-url/matches-about-blank-base-url.window.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/infrastructure/urls/base-url/matches-about-blank-base-url.window.js b/testing/web-platform/tests/html/infrastructure/urls/base-url/matches-about-blank-base-url.window.js
new file mode 100644
index 0000000000..b2a0740ddf
--- /dev/null
+++ b/testing/web-platform/tests/html/infrastructure/urls/base-url/matches-about-blank-base-url.window.js
@@ -0,0 +1,29 @@
+// Verify that an iframe whose URL "matches about:blank" [1] uses its about base
+// URL and initiator/creator origin.
+//
+// [1]: https://html.spec.whatwg.org/#matches-about:blank
+onload = () => {
+ async_test(t => {
+ const iframe = document.createElement('iframe');
+ // Navigate the iframe away from the initial about:blank Document [1] to
+ // isolate the effects of a "matches about:blank" URL.
+ //
+ // [1]: https://html.spec.whatwg.org/#is-initial-about:blank
+ iframe.src = '/common/blank.html';
+
+ iframe.addEventListener('load', e => {
+ assert_equals(iframe.contentWindow.location.pathname, '/common/blank.html');
+
+ // Navigate the iframe to a URL that "matches about:blank" but isn't exactly
+ // "about:blank".
+ iframe.onload = t.step_func_done(() => {
+ assert_equals(iframe.contentDocument.URL, 'about:blank?query#fragment');
+ assert_equals(iframe.contentWindow.origin, window.origin);
+ assert_equals(iframe.contentDocument.baseURI, document.baseURI);
+ });
+ iframe.src = 'about:blank?query#fragment';
+ }, {once: true});
+
+ document.body.appendChild(iframe);
+ }, "about:blank and about:blank?foo#bar both 'match about:blank'");
+};