| <!DOCTYPE html> | |
| <script src="../../resources/testharness.js"></script> | |
| <script src="../../resources/testharnessreport.js"></script> | |
| <body> | |
| <script> | |
| // The specification is unclear for this particular case. We should clarify it | |
| // and merge this test to wpt/html/infrastructure/urls/terminology-0/document-base-url.html | |
| var t = async_test('The fallback base URL of a srcdoc document should be the document base URL of the document\'s browsing context\'s browsing context container\'s document even after the srcdoc document lost its browsing context.'); | |
| t.step(() => { | |
| var iframe = document.createElement('iframe'); | |
| iframe.srcdoc = 'text'; | |
| iframe.onload = t.step_func_done(() => { | |
| var srcdoc = iframe.contentDocument; | |
| assert_equals(srcdoc.baseURI, document.baseURI, 'before detaching'); | |
| iframe.remove(); | |
| srcdoc.body.innerHTML = '<base href="relative/">'; | |
| assert_not_equals(srcdoc.baseURI, 'about:srcdoc', 'after detaching'); | |
| }); | |
| document.body.appendChild(iframe); | |
| }); | |
| </script> | |
| </body> |