Bug 1367450 - Defer initialization of CaptivePortalWatcher to just before completion of delayed startup. r=florian
☠☠ backed out by a3bdbdd4d95a ☠ ☠
authorNihanth Subramanya <nhnt11@gmail.com>
Thu, 01 Jun 2017 06:23:10 +0530
changeset 361821 ff5590f1750d53d058b6ab36513a43d979749991
parent 361820 768208c845b30b551928216939fb16926bd5426a
child 361822 ec18d62f02a94186fee90fc1814efd1c4ced3b51
push id31945
push userryanvm@gmail.com
push dateThu, 01 Jun 2017 20:42:17 +0000
treeherdermozilla-central@15e32469eb04 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1367450
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 1367450 - Defer initialization of CaptivePortalWatcher to just before completion of delayed startup. r=florian MozReview-Commit-ID: I9NKOYEYc5g
browser/base/content/browser-captivePortal.js
browser/base/content/browser.js
--- a/browser/base/content/browser-captivePortal.js
+++ b/browser/base/content/browser-captivePortal.js
@@ -57,19 +57,19 @@ var CaptivePortalWatcher = {
       // A captive portal has already been detected.
       this._captivePortalDetected();
 
       // Automatically open a captive portal tab if there's no other browser window.
       let windows = Services.wm.getEnumerator("navigator:browser");
       if (windows.getNext() == window && !windows.hasMoreElements()) {
         this.ensureCaptivePortalTab();
       }
+    } else if (cps.state == cps.UNKNOWN) {
+      cps.recheckCaptivePortal();
     }
-
-    cps.recheckCaptivePortal();
   },
 
   uninit() {
     Services.obs.removeObserver(this, "captive-portal-login");
     Services.obs.removeObserver(this, "captive-portal-login-abort");
     Services.obs.removeObserver(this, "captive-portal-login-success");
 
 
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1269,17 +1269,16 @@ var gBrowserInit = {
     gPageStyleMenu.init();
     LanguageDetectionListener.init();
     BrowserOnClick.init();
     FeedHandler.init();
     CompactTheme.init();
     AboutPrivateBrowsingListener.init();
     TrackingProtection.init();
     RefreshBlocker.init();
-    CaptivePortalWatcher.init();
     FullZoomUI.init(window);
 
     let mm = window.getGroupMessageManager("browsers");
     mm.loadFrameScript("chrome://browser/content/tab-content.js", true);
     mm.loadFrameScript("chrome://browser/content/content.js", true);
     mm.loadFrameScript("chrome://browser/content/content-UITour.js", true);
     mm.loadFrameScript("chrome://global/content/manifestMessages.js", true);
 
@@ -1712,16 +1711,18 @@ var gBrowserInit = {
     gBrowser.tabContainer.addEventListener("TabSelect", function() {
       for (let panel of document.querySelectorAll("panel[tabspecific='true']")) {
         if (panel.state == "open") {
           panel.hidePopup();
         }
       }
     });
 
+    CaptivePortalWatcher.init();
+
     this.delayedStartupFinished = true;
 
     _resolveDelayedStartup();
     Services.obs.notifyObservers(window, "browser-delayed-startup-finished");
     TelemetryTimestamps.add("delayedStartupFinished");
   },
 
   // Returns the URI(s) to load at startup.