base-url-javascript-nav.https.window.js (766B)
1 // Verify that navigating an about:blank document to a javascript: URL that 2 // creates a new document, copies over the base URL from the old document to the 3 // new document. 4 onload = () => { 5 async_test((t) => { 6 const frame = document.createElement('iframe'); 7 8 frame.onload = () => { 9 assert_equals(document.baseURI, frame.contentDocument.baseURI); 10 11 // We'll need to monitor onload again for the javascript: navigation. 12 frame.onload = () => { 13 assert_equals(document.baseURI, frame.contentDocument.baseURI); 14 assert_equals('foo', frame.contentDocument.body.textContent); 15 }; 16 frame.src = "javascript:'foo'"; 17 t.done(); 18 }; 19 20 document.body.appendChild(frame); 21 }, "javascript: url nav base url test"); 22 };