diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/wasm/wasm_local_iframe_test.html')
-rw-r--r-- | tests/wpt/web-platform-tests/wasm/wasm_local_iframe_test.html | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tests/wpt/web-platform-tests/wasm/wasm_local_iframe_test.html b/tests/wpt/web-platform-tests/wasm/wasm_local_iframe_test.html index 9ccebdc7539..0f4fbd0c719 100644 --- a/tests/wpt/web-platform-tests/wasm/wasm_local_iframe_test.html +++ b/tests/wpt/web-platform-tests/wasm/wasm_local_iframe_test.html @@ -2,16 +2,18 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="resources/load_wasm.js"></script> -<iframe src="resources/frame.html" id="iframe"></iframe> <script> - promise_test(async function() { - var mod = await createWasmModule(); - assert_true(mod instanceof WebAssembly.Module); - var ans = await new Promise((resolve, reject) => { - var iframe = document.getElementById("iframe").contentWindow; - iframe.postMessage(mod, '*'); - window.addEventListener("message", (reply) => resolve(reply.data), false); - }); - assert_equals(ans, 43); - }, "send wasm module to iframe"); + function runTests(iframe) { + iframe = iframe.contentWindow; + promise_test(async function() { + var mod = await createWasmModule(); + assert_true(mod instanceof WebAssembly.Module); + var ans = await new Promise((resolve, reject) => { + iframe.postMessage(mod, '*'); + window.addEventListener("message", (reply) => resolve(reply.data), false); + }); + assert_equals(ans, 43); + }, "send wasm module to iframe"); + } </script> +<iframe src="resources/frame.html" onload="runTests(this)"></iframe> |