base-url-detached-document-srcdoc.https.window.js (833B)
1 // Verify that an about:srcdoc document remembers the baseURI 2 // it was created with even after it's detached. 3 const runTest = () => { 4 async_test((t) => { 5 const frame = document.createElement('iframe'); 6 frame.srcdoc = "foo"; 7 8 frame.onload = () => { 9 const frame_doc = frame.contentDocument; 10 const initial_base_uri = document.baseURI; 11 assert_equals(initial_base_uri, frame_doc.baseURI); 12 13 const base_element = document.createElement('base'); 14 base_element.href = "https://example.com"; 15 document.head.appendChild(base_element); 16 assert_equals(initial_base_uri, frame_doc.baseURI); 17 18 frame.remove(); 19 assert_equals(initial_base_uri, frame_doc.baseURI); 20 t.done(); 21 }; 22 23 document.body.appendChild(frame); 24 }, "about:srcdoc"); 25 }; 26 27 onload = () => { 28 runTest(); 29 };