Bug 1346286 - Remove CPOWs from browser_aboutNetError.js. r=Gijs draft
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 09 Mar 2017 14:49:33 -0800
changeset 499553 55a864ea1b588731aabf851c8459c71ff42d8b61
parent 499552 a65b68cce684c96065a72dbf7563914666c93679
child 499554 2763cf2fae9a306d3900709ee240ddc823d12f8d
push id49450
push userbmo:mrbkap@mozilla.com
push dateWed, 15 Mar 2017 23:51:54 +0000
reviewersGijs
bugs1346286
milestone55.0a1
Bug 1346286 - Remove CPOWs from browser_aboutNetError.js. r=Gijs MozReview-Commit-ID: 8famORaY5uA
browser/base/content/test/general/browser_aboutNetError.js
--- a/browser/base/content/test/general/browser_aboutNetError.js
+++ b/browser/base/content/test/general/browser_aboutNetError.js
@@ -19,26 +19,29 @@ add_task(function* checkReturnToPrevious
     gBrowser.selectedTab = gBrowser.addTab(LOW_TLS_VERSION);
     browser = gBrowser.selectedBrowser;
     pageLoaded = BrowserTestUtils.waitForErrorPage(browser);
   }, false);
 
   info("Loading and waiting for the net error");
   yield pageLoaded;
 
-  Assert.ok(content.document.getElementById("prefResetButton").getBoundingClientRect().left >= 0,
-    "Should have a visible button");
+  // NB: This code assumes that the error page and the test page load in the
+  // same process. If this test starts to fail, it could be because they load
+  // in different processes.
+  yield ContentTask.spawn(browser, LOW_TLS_VERSION, function* (LOW_TLS_VERSION_) {
+    ok(content.document.getElementById("prefResetButton").getBoundingClientRect().left >= 0,
+      "Should have a visible button");
 
-  Assert.ok(content.document.documentURI.startsWith("about:neterror"), "Should be showing error page");
+    ok(content.document.documentURI.startsWith("about:neterror"), "Should be showing error page");
 
-  let pageshowPromise = promiseWaitForEvent(browser, "pageshow");
-  yield ContentTask.spawn(browser, null, function* () {
     let doc = content.document;
     let prefResetButton = doc.getElementById("prefResetButton");
-    Assert.equal(prefResetButton.getAttribute("autofocus"), "true", "prefResetButton has autofocus");
+    is(prefResetButton.getAttribute("autofocus"), "true", "prefResetButton has autofocus");
     prefResetButton.click();
+
+    yield ContentTaskUtils.waitForEvent(this, "pageshow", true);
+
+    is(content.document.documentURI, LOW_TLS_VERSION_, "Should not be showing page");
   });
-  yield pageshowPromise;
-
-  Assert.equal(content.document.documentURI, LOW_TLS_VERSION, "Should not be showing page");
 
   yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });