test_iframe_srcdoc_to_remote.html (1741B)
1 <!DOCTYPE html> 2 <head> 3 <meta charset="utf-8"> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <link rel="stylesheet" href="/tests/SimpleTest/test.css" /> 6 </head> 7 8 <body onload="test()"> 9 <script> 10 /* 11 Test to verify that when we change an OOP iframe to one that has a 12 srcdoc it loads in the correct process, which in this case is this 13 test document. 14 */ 15 SimpleTest.waitForExplicitFinish(); 16 async function test() { 17 // Create an OOP iframe 18 let frame = document.createElement("iframe"); 19 document.body.appendChild(frame); 20 await new Promise(r => { 21 frame.onload = r; 22 // eslint-disable-next-line @microsoft/sdl/no-insecure-url 23 frame.contentWindow.location = "http://example.net/tests/docshell/test/dummy_page.html"; 24 }); 25 26 if (SpecialPowers.effectiveIsolationStrategy() == SpecialPowers.ISOLATION_STRATEGY.IsolateEverything) { 27 ok(SpecialPowers.Cu.isRemoteProxy(frame.contentWindow), "should be a remote frame"); 28 } 29 30 // Remove the attribute so we can set a srcdoc attribute on it 31 frame.removeAttribute("src"); 32 33 // Set a srcdoc attribute on this iframe and wait for the load 34 await new Promise(r => { 35 frame.onload = r; 36 frame.setAttribute("srcdoc", '<html><body>body of the srcdoc frame</body></html>'); 37 }); 38 39 // We should be in the same process as this test document 40 ok(!SpecialPowers.Cu.isRemoteProxy(frame.contentWindow), "should NOT be a remote frame"); 41 SimpleTest.finish(); 42 } 43 </script> 44 </body>