Bug 1344726 - Replace instances of waitForCertErrorLoad with BTU.waitForContentEvent and BTU.waitForErrorPage in browser_captivePortal_certErrorUI.js. r=johannh
authormeghana <meghanagupta3@gmail.com>
Mon, 13 Mar 2017 19:17:48 +0530
changeset 347482 7e35e5f2b9dfb5539598e67e3b08502e111be353
parent 347481 252c03880423b12f9fa7dbccaff423abaa96f7f9
child 347483 addbb183e131e7f3e8b5596b62b50193998578f0
push id31497
push usercbook@mozilla.com
push dateTue, 14 Mar 2017 13:23:16 +0000
treeherdermozilla-central@08f709c14bf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1344726
milestone55.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 1344726 - Replace instances of waitForCertErrorLoad with BTU.waitForContentEvent and BTU.waitForErrorPage in browser_captivePortal_certErrorUI.js. r=johannh MozReview-Commit-ID: JtdZT3v04UP
browser/base/content/test/captivePortal/browser_captivePortal_certErrorUI.js
browser/base/content/test/captivePortal/head.js
--- a/browser/base/content/test/captivePortal/browser_captivePortal_certErrorUI.js
+++ b/browser/base/content/test/captivePortal/browser_captivePortal_certErrorUI.js
@@ -23,17 +23,17 @@ add_task(function* checkCaptivePortalCer
 
   // Open a page with a cert error.
   let browser;
   let certErrorLoaded;
   let errorTab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, () => {
     let tab = gBrowser.addTab(BAD_CERT_PAGE);
     gBrowser.selectedTab = tab;
     browser = gBrowser.selectedBrowser;
-    certErrorLoaded = waitForCertErrorLoad(browser);
+    certErrorLoaded = BrowserTestUtils.waitForContentEvent(browser, "DOMContentLoaded");
     return tab;
   }, false);
 
   info("Waiting for cert error page to load.")
   yield certErrorLoaded;
 
   let portalTabPromise = BrowserTestUtils.waitForNewTab(gBrowser, CANONICAL_URL);
 
@@ -60,17 +60,17 @@ add_task(function* checkCaptivePortalCer
     info("Clicking the Open Login Page button.");
     content.document.getElementById("openPortalLoginPageButton").click();
   });
 
   let portalTab2 = yield portalTabPromise;
   is(portalTab2, portalTab, "The existing portal tab should be focused.");
 
   let portalTabRemoved = BrowserTestUtils.removeTab(portalTab, {dontRemove: true});
-  let errorTabReloaded = waitForCertErrorLoad(browser);
+  let errorTabReloaded = BrowserTestUtils.waitForErrorPage(browser);
 
   Services.obs.notifyObservers(null, "captive-portal-login-success", null);
   yield portalTabRemoved;
 
   info("Waiting for error tab to be reloaded after the captive portal was freed.");
   yield errorTabReloaded;
   yield ContentTask.spawn(browser, null, () => {
     let doc = content.document;
--- a/browser/base/content/test/captivePortal/head.js
+++ b/browser/base/content/test/captivePortal/head.js
@@ -164,18 +164,8 @@ function* closeWindowAndWaitForXulWindow
  * opened window has received focus when the promise resolves, so we
  * have to manually wait every time.
  */
 function* openWindowAndWaitForFocus() {
   let win = yield BrowserTestUtils.openNewBrowserWindow();
   yield SimpleTest.promiseFocus(win);
   return win;
 }
-
-function waitForCertErrorLoad(browser) {
-  return new Promise(resolve => {
-    info("Waiting for DOMContentLoaded event");
-    browser.addEventListener("DOMContentLoaded", function load() {
-      browser.removeEventListener("DOMContentLoaded", load, false, true);
-      resolve();
-    }, false, true);
-  });
-}