Bug 1371142 - Confirm that the page loaded is about:blank before continuing with the test. r?gijs draft
authorJared Wein <jwein@mozilla.com>
Wed, 18 Jul 2018 15:40:37 -0400
changeset 820191 c828db155fd9b1c9cc389114fb61be1deedb4b5e
parent 819215 547144f5596c1a146b208d68d93950a6313080ca
push id116745
push userbmo:jaws@mozilla.com
push dateThu, 19 Jul 2018 03:53:02 +0000
reviewersgijs
bugs1371142
milestone63.0a1
Bug 1371142 - Confirm that the page loaded is about:blank before continuing with the test. r?gijs This matches the behavior that is implemented in subdialogs.js where the load event handler is not removed until the new location is about:blank. MozReview-Commit-ID: FZHW6Z63M2M
browser/components/preferences/in-content/tests/browser_subdialogs.js
--- a/browser/components/preferences/in-content/tests/browser_subdialogs.js
+++ b/browser/components/preferences/in-content/tests/browser_subdialogs.js
@@ -73,17 +73,19 @@ async function close_subdialog_and_test_
     info("waiting for dialogclosing");
     let closingEvent =
       await ContentTaskUtils.waitForEvent(frame.contentWindow, "dialogclosing");
     let contentClosingButton = closingEvent.detail.button;
     let actualAcceptCount = frame.contentWindow.arguments &&
                             frame.contentWindow.arguments[0].acceptCount;
 
     info("waiting for about:blank load");
-    await ContentTaskUtils.waitForEvent(frame, "load");
+    await ContentTaskUtils.waitForEvent(frame, "load", false, () => {
+      return frame.contentWindow.location.href == "about:blank";
+    });
 
     Assert.notEqual(win.getComputedStyle(subdialog._overlay).visibility, "visible",
       "overlay is not visible");
     Assert.equal(frame.getAttribute("style"), "", "inline styles should be cleared");
     Assert.equal(frame.contentWindow.location.href.toString(), "about:blank",
       "sub-dialog should be unloaded");
     Assert.equal(contentClosingButton, expectations.closingButton,
       "closing event should indicate button was '" + expectations.closingButton + "'");