Document-parseHTMLUnsafe-url-moretests.html (1482B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <!-- This test was adapted from DOMParser-parseFromString-url-moretests.html --> 4 <meta charset=utf-8> 5 <title>Document.parseHTMLUnsafe: Document's url</title> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <div id=log></div> 9 <script> 10 async_test(function() { 11 var iframe = document.createElement("iframe"); 12 iframe.onload = this.step_func(function() { 13 var child = iframe.contentWindow; 14 15 test(function() { 16 var doc = Document.parseHTMLUnsafe("<html></html>"); 17 assert_equals(doc.URL, "about:blank"); 18 }, "Parent window"); 19 20 test(function() { 21 var doc = child.Document.parseHTMLUnsafe("<html></html>"); 22 assert_equals(doc.URL, "about:blank"); 23 }, "Child window"); 24 25 var dpBeforeNavigation = child.Document, urlBeforeNavigation = child.document.URL; 26 iframe.onload = this.step_func_done(function() { 27 test(function() { 28 var doc = dpBeforeNavigation.parseHTMLUnsafe("<html></html>"); 29 assert_equals(doc.URL, "about:blank"); 30 }, "Child window crossing navigation"); 31 32 test(function() { 33 var doc = child.Document.parseHTMLUnsafe("<html></html>"); 34 assert_equals(doc.URL, "about:blank"); 35 }, "Child window after navigation"); 36 }); 37 iframe.src = "/common/blank.html?2"; 38 }); 39 iframe.src = "/common/blank.html?1"; 40 document.body.appendChild(iframe); 41 }); 42 </script>