From 8faaf785c817385d86a586e6632438cc37fc9b86 Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Fri, 10 Jun 2016 00:51:33 +0300 Subject: [PATCH] Bug 1273950 - Add pref to check captive portal without waiting for network activity r=MattN MozReview-Commit-ID: 6NG8BF4PYtp --- toolkit/components/captivedetect/captivedetect.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/toolkit/components/captivedetect/captivedetect.js b/toolkit/components/captivedetect/captivedetect.js index 74f237dde234..f727d6a6d53b 100644 --- a/toolkit/components/captivedetect/captivedetect.js +++ b/toolkit/components/captivedetect/captivedetect.js @@ -89,6 +89,8 @@ function LoginObserver(captivePortalDetector) { .getService(Ci.nsIHttpActivityDistributor); let urlFetcher = null; + let waitForNetworkActivity = Services.appinfo.widgetToolkit == "gonk"; + let pageCheckingDone = function pageCheckingDone() { if (state === LOGIN_OBSERVER_STATE_VERIFYING) { urlFetcher = null; @@ -177,10 +179,14 @@ function LoginObserver(captivePortalDetector) { state = LOGIN_OBSERVER_STATE_VERIFY_NEEDED; // Fall though to start polling timer case LOGIN_OBSERVER_STATE_IDLE: - timer.initWithCallback(this, - captivePortalDetector._pollingTime, - timer.TYPE_ONE_SHOT); - break; + if (waitForNetworkActivity) { + timer.initWithCallback(this, + captivePortalDetector._pollingTime, + timer.TYPE_ONE_SHOT); + break; + } + // if we don't need to wait for network activity, just fall through + // to perform a captive portal check. case LOGIN_OBSERVER_STATE_VERIFY_NEEDED: // Polling the canonical website since network stays idle for a while state = LOGIN_OBSERVER_STATE_VERIFYING;