| <!DOCTYPE html> |
| <script src="../resources/js-test.js"></script> |
| <script src="../resources/wasm-builder.js"></script> |
| <script src="./resources/load_wasm.js"></script> |
| <script> |
| description("Test that expected Wasm Module can be sent over iframe.postMessage."); |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| |
| function finish(value) { |
| shouldBe(() => value, () => 35010); |
| |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| window.addEventListener("message", value => run(), { once:true }, false); |
| |
| var run = async function () { |
| try { |
| window.addEventListener("message", (answer) => finish(answer.data), false); |
| var mod = await createWasmModule(); |
| var iframe = document.getElementById("iframe").contentWindow; |
| iframe.postMessage(mod, '*'); |
| } catch (e) { |
| debug('error:' + e); |
| } |
| }; |
| </script> |
| <iframe src="./resources/frame.html" id="iframe"></iframe> |