Bug 1383683 - Fix race in wpt /wasm/wasm_local_iframe_test.html (r=bz)

MozReview-Commit-ID: AS9o85KiBMG

--HG--
extra : rebase_source : ac2748155ab400b74ca17a57ca2e17d58f67e44d
This commit is contained in:
Luke Wagner 2017-11-29 12:07:12 -06:00
Родитель 700aa2f9ba
Коммит 86833df6a0
1 изменённых файлов: 13 добавлений и 11 удалений

Просмотреть файл

@ -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>
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) => {
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");
}
</script>
<iframe src="resources/frame.html" onload="runTests(this)"></iframe>