diff --git a/browser/modules/CaptivePortalWatcher.jsm b/browser/modules/CaptivePortalWatcher.jsm index 29ef39df132f..f29e0515ddac 100644 --- a/browser/modules/CaptivePortalWatcher.jsm +++ b/browser/modules/CaptivePortalWatcher.jsm @@ -47,10 +47,14 @@ this.CaptivePortalWatcher = { Services.obs.addObserver(this, "captive-portal-login-abort", false); Services.obs.addObserver(this, "captive-portal-login-success", false); this._initialized = true; + if (cps.state == cps.LOCKED_PORTAL) { // A captive portal has already been detected. this._addCaptivePortalTab(); + return; } + + cps.recheckCaptivePortal(); }, uninit() { @@ -110,8 +114,8 @@ this.CaptivePortalWatcher = { } let win = RecentWindow.getMostRecentBrowserWindow(); - if (!win.document.hasFocus()) { - // The document that got focused was not in a browser window. + if (win != Services.ww.activeWindow) { + // The window that got focused was not a browser window. return; } Services.obs.removeObserver(this, "xul-window-visible");