matches-about-blank-base-url.window.js (1213B)
1 // Verify that an iframe whose URL "matches about:blank" [1] uses its about base 2 // URL and initiator/creator origin. 3 // 4 // [1]: https://html.spec.whatwg.org/#matches-about:blank 5 onload = () => { 6 async_test(t => { 7 const iframe = document.createElement('iframe'); 8 // Navigate the iframe away from the initial about:blank Document [1] to 9 // isolate the effects of a "matches about:blank" URL. 10 // 11 // [1]: https://html.spec.whatwg.org/#is-initial-about:blank 12 iframe.src = '/common/blank.html'; 13 14 iframe.addEventListener('load', e => { 15 assert_equals(iframe.contentWindow.location.pathname, '/common/blank.html'); 16 17 // Navigate the iframe to a URL that "matches about:blank" but isn't exactly 18 // "about:blank". 19 iframe.onload = t.step_func_done(() => { 20 assert_equals(iframe.contentDocument.URL, 'about:blank?query#fragment'); 21 assert_equals(iframe.contentWindow.origin, window.origin); 22 assert_equals(iframe.contentDocument.baseURI, document.baseURI); 23 }); 24 iframe.src = 'about:blank?query#fragment'; 25 }, {once: true}); 26 27 document.body.appendChild(iframe); 28 }, "about:blank and about:blank?foo#bar both 'match about:blank'"); 29 };