Unreviewed, fix test failures after r239698.
[WebKit-https.git] / LayoutTests / wasm / iframe-parent-postmessage.html
1 <!DOCTYPE html>
2 <script src="../resources/js-test.js"></script>
3 <script src="../resources/wasm-builder.js"></script>
4 <script src="./resources/load_wasm.js"></script>
5 <script>
6 description("Test that expected Wasm Module can be sent over window.parent.postMessage from iframe.");
7 if (window.testRunner)
8     testRunner.waitUntilDone();
9
10 function finish(value) {
11     shouldBe(() => value, () => 35010);
12
13     if (window.testRunner)
14         testRunner.notifyDone();
15 }
16
17 window.addEventListener("message", value =>  run(), { once:true }, false);
18
19 var run = async function () {
20     try {
21         window.addEventListener("message", (answer) => finish(answer.data), false);
22         var mod = await createWasmModule();
23         var iframe = document.getElementById("iframe").contentWindow;
24         iframe.postMessage(mod, '*');
25     } catch (e) {
26         console.log('error:', e);
27     }
28 };
29 </script>
30 <iframe src="./resources/frame-parent.html" id="iframe"></iframe>