Bug 1283714 - Wait for test document load in test_child_docshell.html to fix an intermittent. r=bz
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 23 Apr 2018 08:19:52 -0700
changeset 468998 eb4c9a9c7320474ca9690fd23414f336d40f32b5
parent 468997 c3ce5469b3ae507082792fdd206f43af41b62c88
child 468999 7a9b9ce05f857f8a96595ccd90d556d032654a1a
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1283714
milestone61.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 1283714 - Wait for test document load in test_child_docshell.html to fix an intermittent. r=bz MozReview-Commit-ID: 2qfn77LmG3b
dom/ipc/tests/test_child_docshell.html
--- a/dom/ipc/tests/test_child_docshell.html
+++ b/dom/ipc/tests/test_child_docshell.html
@@ -71,17 +71,25 @@ SpecialPowers.pushPrefEnv({'set':[
                                 .QueryInterface(Ci.nsIDocShell);
       sendAsyncMessage("DOMWindowCreatedReceived", {
         stableChromeEventHandler: chromeEventHandler === docShell.chromeEventHandler,
         iframeHasNewDocShell: new_docShell !== docShell,
         iframeHasSameChromeEventHandler: new_docShell.chromeEventHandler === chromeEventHandler
       });
     });
 
-    let i = content.document.createElement("iframe");
-    i.setAttribute("src", "data:text/html,foo");
-    content.document.documentElement.appendChild(i);
+    function go() {
+      let i = content.document.createElement("iframe");
+      i.setAttribute("src", "data:text/html,foo");
+      content.document.documentElement.appendChild(i);
+    }
+
+    if (content.document.readyState == "complete") {
+      go();
+    } else {
+      addEventListener("load", go, { once: true, capture: true });
+    }
   }, false);
 });
 
 </script>
 </body>
 </html>