Bug 1383683 - Fix race in wpt /wasm/wasm_local_iframe_test.html. r=bz, a=test-only
authorLuke Wagner <luke@mozilla.com>
Wed, 29 Nov 2017 12:07:12 -0600
changeset 445043 8a211176cf75a4453c5efe75a4e5c6216c4058e1
parent 445042 b1240985b0eba0614202df34cc14ad61dfb48e81
child 445044 8181d6ed6340ad7028fa4b7b227814da1fb604b1
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, test-only
bugs1383683
milestone58.0
Bug 1383683 - Fix race in wpt /wasm/wasm_local_iframe_test.html. r=bz, a=test-only MozReview-Commit-ID: AS9o85KiBMG
testing/web-platform/tests/wasm/wasm_local_iframe_test.html
--- a/testing/web-platform/tests/wasm/wasm_local_iframe_test.html
+++ b/testing/web-platform/tests/wasm/wasm_local_iframe_test.html
@@ -1,17 +1,19 @@
 <!DOCTYPE html>
 <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>