document-domain-removed-iframe.html (2115B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>document.domain and removed iframe interaction</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <!-- This is a test for https://crbug.com/1095145 where window 8 properties become undefined for document.domain-using removed 9 iframes --> 10 11 <div id="log"></div> 12 13 <script> 14 "use strict"; 15 16 promise_test(t => { 17 return new Promise(resolve => { 18 const iframe = document.createElement("iframe"); 19 iframe.onload = t.step_func(() => { 20 const { contentWindow } = iframe; 21 assert_equals(contentWindow.status, ""); 22 resolve(); 23 }); 24 iframe.src = "/common/blank.html"; 25 document.body.append(iframe); 26 }); 27 }, "No removal, no document.domain"); 28 29 promise_test(t => { 30 return new Promise(resolve => { 31 const iframe = document.createElement("iframe"); 32 iframe.onload = t.step_func(() => { 33 const { contentWindow } = iframe; 34 iframe.remove(); 35 assert_equals(contentWindow.status, ""); 36 resolve(); 37 }); 38 iframe.src = "/common/blank.html"; 39 document.body.append(iframe); 40 }); 41 }, "Removal, no document.domain"); 42 43 promise_test(t => { 44 return new Promise(resolve => { 45 const iframe = document.createElement("iframe"); 46 iframe.onload = t.step_func(() => { 47 document.domain = document.domain; 48 const { contentWindow } = iframe; 49 assert_equals(contentWindow.status, ""); 50 resolve(); 51 }); 52 iframe.src = "resources/document-domain-setter.html"; 53 document.body.append(iframe); 54 }); 55 }, "No removal, document.domain"); 56 57 promise_test(t => { 58 return new Promise(resolve => { 59 const iframe = document.createElement("iframe"); 60 iframe.onload = t.step_func(() => { 61 document.domain = document.domain; // technically we already did this above 62 const { contentWindow } = iframe; 63 iframe.remove(); 64 assert_equals(contentWindow.status, ""); 65 resolve(); 66 }); 67 iframe.src = "resources/document-domain-setter.html"; 68 document.body.append(iframe); 69 }); 70 }, "Removal, document.domain"); 71 72 </script>