Bug 1231552 - Back out bug 1121800, bug 1207798 and bug 1214200 changesets. r=mcmanus
authorDaniel Stenberg <daniel@haxx.se>
Thu, 10 Dec 2015 07:21:00 +0100
changeset 276168 e8b02a6a50d2a5c864d636931296d51e4fd89c4c
parent 276167 8dfb9aeac3af19e6d0b816b45cca5c5950d35b49
child 276169 48c873c8b0e8496ae35c5e625f151585df1fa9ee
push id69067
push usercbook@mozilla.com
push dateFri, 11 Dec 2015 08:23:49 +0000
treeherdermozilla-inbound@e8b02a6a50d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1231552, 1121800, 1207798, 1214200
milestone45.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 1231552 - Back out bug 1121800, bug 1207798 and bug 1214200 changesets. r=mcmanus
modules/libpref/init/all.js
netwerk/base/nsProtocolProxyService.cpp
netwerk/base/nsProtocolProxyService.h
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1822,23 +1822,16 @@ pref("network.proxy.ssl",               
 pref("network.proxy.ssl_port",              0);
 pref("network.proxy.socks",                 "");
 pref("network.proxy.socks_port",            0);
 pref("network.proxy.socks_version",         5);
 pref("network.proxy.socks_remote_dns",      false);
 pref("network.proxy.proxy_over_tls",        true);
 pref("network.proxy.no_proxies_on",         "localhost, 127.0.0.1");
 pref("network.proxy.failover_timeout",      1800); // 30 minutes
-
-// If this value is 'true' and a PAC or all given proxies are inaccessible or
-// failing, Firefox will attempt to connect to the server DIRECTly. Meaning
-// without a proxy. If set 'false', Firefox will not try to access without
-// proxy.
-pref("network.proxy.use_direct_on_fail",    true);
-
 pref("network.online",                      true); //online/offline
 pref("network.cookie.cookieBehavior",       0); // 0-Accept, 1-dontAcceptForeign, 2-dontAcceptAny, 3-limitForeign
 #ifdef ANDROID
 pref("network.cookie.cookieBehavior",       0); // Keep the old default of accepting all cookies
 #endif
 pref("network.cookie.thirdparty.sessionOnly", false);
 pref("network.cookie.lifetimePolicy",       0); // 0-accept, 1-dontUse 2-acceptForSession, 3-acceptForNDays
 pref("network.cookie.alwaysAcceptSessionCookies", false);
--- a/netwerk/base/nsProtocolProxyService.cpp
+++ b/netwerk/base/nsProtocolProxyService.cpp
@@ -642,22 +642,16 @@ nsProtocolProxyService::PrefsChanged(nsI
         proxy_GetBoolPref(prefBranch, PROXY_PREF("socks_remote_dns"),
                           mSOCKSProxyRemoteDNS);
 
     if (!pref || !strcmp(pref, PROXY_PREF("proxy_over_tls"))) {
         proxy_GetBoolPref(prefBranch, PROXY_PREF("proxy_over_tls"),
                           mProxyOverTLS);
     }
 
-    // when proxies fail, try DIRECT
-    if (!pref || !strcmp(pref, PROXY_PREF("use_direct_on_fail"))) {
-        proxy_GetBoolPref(prefBranch, PROXY_PREF("use_direct_on_fail"),
-                          mFailoverToDirect);
-    }
-
     if (!pref || !strcmp(pref, PROXY_PREF("failover_timeout")))
         proxy_GetIntPref(prefBranch, PROXY_PREF("failover_timeout"),
                          mFailedProxyTimeout);
 
     if (!pref || !strcmp(pref, PROXY_PREF("no_proxies_on"))) {
         rv = prefBranch->GetCharPref(PROXY_PREF("no_proxies_on"),
                                      getter_Copies(tempString));
         if (NS_SUCCEEDED(rv))
@@ -1429,29 +1423,21 @@ nsProtocolProxyService::NewProxyInfoWith
 }
 
 NS_IMETHODIMP
 nsProtocolProxyService::GetFailoverForProxy(nsIProxyInfo  *aProxy,
                                             nsIURI        *aURI,
                                             nsresult       aStatus,
                                             nsIProxyInfo **aResult)
 {
-    if (mFailoverToDirect) {
-        if (mProxyConfig == PROXYCONFIG_DIRECT) {
-            return NS_ERROR_NOT_AVAILABLE;
-        }
-    } else {
-        // We only support failover when a PAC file is configured, either
-        // directly or via system settings
-        if (mProxyConfig != PROXYCONFIG_PAC &&
-            mProxyConfig != PROXYCONFIG_WPAD &&
-            mProxyConfig != PROXYCONFIG_SYSTEM) {
-            return NS_ERROR_NOT_AVAILABLE;
-        }
-    }
+    // We only support failover when a PAC file is configured, either
+    // directly or via system settings
+    if (mProxyConfig != PROXYCONFIG_PAC && mProxyConfig != PROXYCONFIG_WPAD &&
+        mProxyConfig != PROXYCONFIG_SYSTEM)
+        return NS_ERROR_NOT_AVAILABLE;
 
     // Verify that |aProxy| is one of our nsProxyInfo objects.
     nsCOMPtr<nsProxyInfo> pi = do_QueryInterface(aProxy);
     NS_ENSURE_ARG(pi);
     // OK, the QI checked out.  We can proceed.
 
     // Remember that this proxy is down.
     DisableProxy(pi);
@@ -2045,65 +2031,62 @@ nsProtocolProxyService::PruneProxyInfo(c
                 last = iter;
                 iter = iter->mNext;
             }
         }
         if (!head)
             return;
     }
 
-    // Now, scan to the next proxy not disabled. If all proxies are disabled,
-    // return blank list to enforce a DIRECT rule.
+    // Now, scan to see if all remaining proxies are disabled.  If so, then
+    // we'll just bail and return them all.  Otherwise, we'll go and prune the
+    // disabled ones.
 
     bool allDisabled = true;
+
     nsProxyInfo *iter;
-
-    if (!mFailoverToDirect) {
-        for (iter = head; iter; iter = iter->mNext) {
-            if (!IsProxyDisabled(iter)) {
-                allDisabled = false;
-                break;
-            }
+    for (iter = head; iter; iter = iter->mNext) {
+        if (!IsProxyDisabled(iter)) {
+            allDisabled = false;
+            break;
         }
     }
 
-    if (!mFailoverToDirect && allDisabled) {
+    if (allDisabled)
         LOG(("All proxies are disabled, so trying all again"));
-    } else {
+    else {
         // remove any disabled proxies.
         nsProxyInfo *last = nullptr;
         for (iter = head; iter; ) {
             if (IsProxyDisabled(iter)) {
                 // reject!
                 nsProxyInfo *reject = iter;
 
                 iter = iter->mNext;
-                if (last) {
+                if (last)
                     last->mNext = iter;
-                }
-            else
-                head = iter;
+                else
+                    head = iter;
 
                 reject->mNext = nullptr;
                 NS_RELEASE(reject);
                 continue;
             }
 
-            allDisabled = false;
+            // since we are about to use this proxy, make sure it is not on
+            // the disabled proxy list.  we'll add it back to that list if
+            // we have to (in GetFailoverForProxy).
+            //
+            // XXX(darin): It might be better to do this as a final pass.
+            //
             EnableProxy(iter);
 
             last = iter;
             iter = iter->mNext;
         }
     }
 
-    if (mFailoverToDirect && allDisabled) {
-        LOG(("All proxies are disabled, try a DIRECT rule!"));
-        *list = nullptr;
-        return;
-    }
-
     // if only DIRECT was specified then return no proxy info, and we're done.
     if (head && !head->mNext && head->mType == kProxyType_DIRECT)
         NS_RELEASE(head);
 
     *list = head;  // Transfer ownership
 }
--- a/netwerk/base/nsProtocolProxyService.h
+++ b/netwerk/base/nsProtocolProxyService.h
@@ -391,19 +391,16 @@ protected:
 
     RefPtr<nsPACMan>           mPACMan;  // non-null if we are using PAC
     nsCOMPtr<nsISystemProxySettings> mSystemProxySettings;
 
     PRTime                       mSessionStart;
     nsFailedProxyTable           mFailedProxies;
     int32_t                      mFailedProxyTimeout;
 
-    // 'true' means try DIRECT when the proxies fail
-    bool                         mFailoverToDirect;
-
 private:
     nsresult AsyncResolveInternal(nsIChannel *channel, uint32_t flags,
                                   nsIProtocolProxyCallback *callback,
                                   nsICancelable **result,
                                   bool isSyncOK);
 
 };