window-simple-success.html (2147B)
1 <!DOCTYPE html> 2 <!-- Based on similar tests in html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/ --> 3 <meta charset="utf-8"> 4 <title>Structured cloning of WebAssembly.Module: simple success cases that don't need dedicated files</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="./resources/test-incrementer.js"></script> 8 9 <div id="log"></div> 10 11 <script> 12 "use strict"; 13 14 promise_test(t => { 15 const worker = new Worker("resources/incrementer-worker.js"); 16 17 return testSharingViaIncrementerScript(t, worker, "window", worker, "worker", undefined); 18 }, "postMessaging to a dedicated worker allows them to instantiate"); 19 20 promise_test(t => { 21 return new Promise(resolve => { 22 const iframe = document.createElement("iframe"); 23 iframe.onload = t.step_func(() => { 24 resolve(testSharingViaIncrementerScript(t, window, "window", iframe.contentWindow, "iframe", "*")); 25 }); 26 iframe.src = "resources/incrementer-iframe.html"; 27 document.body.appendChild(iframe); 28 }); 29 }, "postMessaging to a same-origin iframe allows them to instantiate"); 30 31 promise_test(t => { 32 return new Promise(resolve => { 33 const iframe = document.createElement("iframe"); 34 iframe.onload = t.step_func(() => { 35 const level1 = iframe.contentWindow; 36 const level2 = level1.frames[0]; 37 const level3 = level2.frames[0]; 38 const targetWindow = level3.frames[0]; 39 resolve(testSharingViaIncrementerScript(t, window, "window", targetWindow, "nested iframe", "*")); 40 }); 41 iframe.src = "resources/nested-iframe-1.html"; 42 document.body.appendChild(iframe); 43 }); 44 }, "postMessaging to a same-origin deeply-nested iframe allows them to instantiate"); 45 46 promise_test(t => { 47 return new Promise(resolve => { 48 const w = window.open("resources/incrementer-popup.html"); 49 w.onload = t.step_func(() => { 50 resolve(testSharingViaIncrementerScript(t, window, "window", w, "popup window", "*").then(() => { 51 w.close(); 52 })); 53 }); 54 }); 55 }, "postMessaging to a same-origin opened window allows them to instantiate"); 56 57 </script>