Bug 1586944 - more reliable way to detect pageLoaded, r=annevk
authorJunior Hsu <juhsu@mozilla.com>
Fri, 15 Nov 2019 10:43:47 +0000
changeset 502272 09df60fc6e235e6d4c9594cc7edcb55cb82d460e
parent 502271 1159b7bcfbd2f71f8dc326e3e66d2e0337a147af
child 502273 998d992ca22bda687da401a82ddb42afc10af96a
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersannevk
bugs1586944
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1586944 - more reliable way to detect pageLoaded, r=annevk Differential Revision: https://phabricator.services.mozilla.com/D52891
testing/web-platform/tests/html/cross-origin-embedder-policy/none.https.html
testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp.https.html
--- a/testing/web-platform/tests/html/cross-origin-embedder-policy/none.https.html
+++ b/testing/web-platform/tests/html/cross-origin-embedder-policy/none.https.html
@@ -49,31 +49,34 @@ async_test(t => {
     }, 500);
   }, 500);
 }, `"none" top-level: navigating a frame back from "require-corp" should succeed`);
 
 async_test(t => {
   let pageLoaded = false;
   const bc = new BroadcastChannel(token());
   let finished = false;
+  let doneCheck = _ => {
+    if (finished && pageLoaded) {
+      t.done();
+    }
+  }
   bc.onmessage = t.step_func((event) => {
     pageLoaded = true;
     let payload = event.data;
     assert_equals(payload, "loaded");
+
+    doneCheck();
   });
 
   const bc2 = new BroadcastChannel(token());
   bc2.onmessage = t.step_func((event) => {
     finished = true;
     let payload = event.data;
     assert_equals(payload, "loaded");
+
+    doneCheck();
   });
 
   const win = window.open(`resources/navigate-require-corp.sub.html?channelName=${bc.name}&to=navigate-none.sub.html?channelName=${bc2.name}`, "_blank", "noopener");
   assert_equals(win, null);
-
-  t.step_timeout(() => {
-    assert_true(pageLoaded);
-    assert_true(finished);
-    t.done();
-  }, 500);
 }, `"require-corp" top-level noopener popup: navigating to "none" should succeed`);
 </script>
--- a/testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp.https.html
+++ b/testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp.https.html
@@ -67,20 +67,16 @@ async_test(t => {
   bc.onmessage = t.step_func_done((event) => {
     pageLoaded = true;
     let payload = event.data;
     assert_equals(payload, "loaded");
   });
 
   const win = window.open(`resources/navigate-none.sub.html?channelName=${bc.name}&to=/common/blank.html`, "_blank");
   t.add_cleanup(() => win.close());
-  t.step_timeout(() => {
-    assert_equals(pageLoaded, true);
-    t.done();
-  }, 2000);
 }, `"require-corp" top-level: creating a "none" popup should succeed.`);
 
 [
   {
     "name": "",
     "title": "as popup"
   },
   {