Backed out 6 changesets (bug 939318) for Windows xpcshell failures on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 29 Aug 2014 14:22:47 -0400
changeset 224003 11e4f1678eaba483e926440ab2ef8fe0e0dde99e
parent 224002 74637aa07226e3360d6890bace2a91c337f78340
child 224013 8fdcd7e6ecb252f7168d69909884f55d874fff4e
child 224124 2123851421e66b93cf312045a0d2fc9f762eb569
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs939318
milestone34.0a1
backs outfaece15110ef19190c179ed309d6391303a50b6c
ecc0368d9283018519be5f05fd37159cb7122bd0
4dcb889cf913c5c42c4646fa1d924ba499a703ae
2fe8c65c26c26eaeeba5c06cad279979d65c1174
0b9c1bbc78266bcbef7c8059ae2ee1a5625b207a
fc191ae0a0e8aed804a77b3918cf827ca2a2b0da
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
Backed out 6 changesets (bug 939318) for Windows xpcshell failures on a CLOSED TREE. Backed out changeset faece15110ef (bug 939318) Backed out changeset ecc0368d9283 (bug 939318) Backed out changeset 4dcb889cf913 (bug 939318) Backed out changeset 2fe8c65c26c2 (bug 939318) Backed out changeset 0b9c1bbc7826 (bug 939318) Backed out changeset fc191ae0a0e8 (bug 939318)
modules/libpref/init/all.js
netwerk/base/public/nsINetworkLinkService.idl
netwerk/base/src/nsIOService.cpp
netwerk/base/src/nsIOService.h
netwerk/base/src/nsProtocolProxyService.cpp
netwerk/dns/nsDNSService2.cpp
netwerk/dns/nsHostResolver.cpp
netwerk/dns/nsHostResolver.h
netwerk/protocol/http/ASpdySession.h
netwerk/protocol/http/Http2Session.cpp
netwerk/protocol/http/Http2Session.h
netwerk/protocol/http/SpdySession3.cpp
netwerk/protocol/http/SpdySession3.h
netwerk/protocol/http/SpdySession31.cpp
netwerk/protocol/http/SpdySession31.h
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnection.h
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpConnectionMgr.h
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/websocket/BaseWebSocketChannel.cpp
netwerk/protocol/websocket/BaseWebSocketChannel.h
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/protocol/websocket/WebSocketChannel.h
netwerk/system/win32/nsNotifyAddrListener.cpp
netwerk/system/win32/nsNotifyAddrListener.h
netwerk/test/unit/test_ping_aboutnetworking.js
netwerk/test/unit/test_proxy-failover_passing.js
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -985,20 +985,16 @@ pref("security.fileuri.strict_origin_pol
 // prevents necko connecting to ports 1-5 unless the protocol
 // overrides.
 
 // Allow necko to do A/B testing. Will generally only happen if
 // telemetry is also enabled as otherwise there is no way to report
 // the results
 pref("network.allow-experiments", true);
 
-// Allow the network changed event to get sent when a network topology or
-// setup change is noticed while running.
-pref("network.notify.changed", true);
-
 // Transmit UDP busy-work to the LAN when anticipating low latency
 // network reads and on wifi to mitigate 802.11 Power Save Polling delays
 pref("network.tickle-wifi.enabled", false);
 pref("network.tickle-wifi.duration", 400);
 pref("network.tickle-wifi.delay", 16);
 
 // Turn off interprocess security checks. Needed to run xpcshell tests.
 pref("network.disable.ipc.security", false);
@@ -1165,21 +1161,16 @@ pref("network.http.qos", 0);
 // to wait before trying a different connection. 0 means do not use a second
 // connection.
 pref("network.http.connection-retry-timeout", 250);
 
 // The number of seconds after sending initial SYN for an HTTP connection
 // to give up if the OS does not give up first
 pref("network.http.connection-timeout", 90);
 
-// The number of seconds to allow active connections to prove that they have
-// traffic before considered stalled, after a network change has been detected
-// and signalled.
-pref("network.http.network-changed.timeout", 5);
-
 // The maximum number of current global half open sockets allowable
 // when starting a new speculative connection.
 pref("network.http.speculative-parallel-limit", 6);
 
 // Whether or not to block requests for non head js/css items (e.g. media)
 // while those elements load.
 pref("network.http.rendering-critical-requests-prioritization", true);
 
--- a/netwerk/base/public/nsINetworkLinkService.idl
+++ b/netwerk/base/public/nsINetworkLinkService.idl
@@ -5,17 +5,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 /**
  * Network link status monitoring service.
  */
-[scriptable, uuid(2deead82-1d29-45f5-8c59-5dbee477cff8)]
+[scriptable, uuid(f7d3be87-7403-4a1e-b89f-2797776e9b08)]
 interface nsINetworkLinkService : nsISupports
 {
   /* Link type constants */
   const unsigned long LINK_TYPE_UNKNOWN = 0;
   const unsigned long LINK_TYPE_ETHERNET = 1;
   const unsigned long LINK_TYPE_USB = 2;
   const unsigned long LINK_TYPE_WIFI = 3;
   const unsigned long LINK_TYPE_WIMAX = 4;
@@ -60,21 +60,16 @@ interface nsINetworkLinkService : nsISup
  * isLinkUp is now true, linkStatusKnown is true.
  */
 #define NS_NETWORK_LINK_DATA_UP      "up"
 /**
  * isLinkUp is now false, linkStatusKnown is true.
  */
 #define NS_NETWORK_LINK_DATA_DOWN    "down"
 /**
- * isLinkUp is still true, but the network setup is modified.
- * linkStatusKnown is true.
- */
-#define NS_NETWORK_LINK_DATA_CHANGED "changed"
-/**
  * linkStatusKnown is now false.
  */
 #define NS_NETWORK_LINK_DATA_UNKNOWN "unknown"
 
 /**
  * We send notifications through nsIObserverService with topic
  * NS_NETWORK_LINK_TYPE_TOPIC whenever the network connection type
  * changes. We pass one of the valid connection type constants
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -32,17 +32,16 @@
 #include "nsICancelable.h"
 #include "nsINetworkLinkService.h"
 #include "nsPISocketTransportService.h"
 #include "nsAsyncRedirectVerifyHelper.h"
 #include "nsURLHelper.h"
 #include "nsPIDNSService.h"
 #include "nsIProtocolProxyService2.h"
 #include "MainThreadUtils.h"
-#include "nsIWidget.h"
 
 #if defined(XP_WIN)
 #include "nsNativeConnectionHelper.h"
 #endif
 
 using namespace mozilla;
 
 #define PORT_PREF_PREFIX           "network.security.ports."
@@ -50,25 +49,24 @@ using namespace mozilla;
 #define AUTODIAL_PREF              "network.autodial-helper.enabled"
 #define MANAGE_OFFLINE_STATUS_PREF "network.manage-offline-status"
 
 // Nb: these have been misnomers since bug 715770 removed the buffer cache.
 // "network.segment.count" and "network.segment.size" would be better names,
 // but the old names are still used to preserve backward compatibility.
 #define NECKO_BUFFER_CACHE_COUNT_PREF "network.buffer.cache.count"
 #define NECKO_BUFFER_CACHE_SIZE_PREF  "network.buffer.cache.size"
-#define NETWORK_NOTIFY_CHANGED_PREF   "network.notify.changed"
 
 #define MAX_RECURSION_COUNT 50
 
 nsIOService* gIOService = nullptr;
 static bool gHasWarnedUploadChannel2;
 
-// A general port blacklist.  Connections to these ports will not be allowed
-// unless the protocol overrides.
+// A general port blacklist.  Connections to these ports will not be allowed unless 
+// the protocol overrides.
 //
 // TODO: I am sure that there are more ports to be added.  
 //       This cut is based on the classic mozilla codebase
 
 int16_t gBadPortList[] = { 
   1,    // tcpmux          
   7,    // echo     
   9,    // discard          
@@ -145,17 +143,16 @@ nsIOService::nsIOService()
     , mOfflineForProfileChange(false)
     , mManageOfflineStatus(false)
     , mSettingOffline(false)
     , mSetOfflineValue(false)
     , mShutdown(false)
     , mNetworkLinkServiceInitialized(false)
     , mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY)
     , mAutoDialEnabled(false)
-    , mNetworkNotifyChanged(true)
 {
 }
 
 nsresult
 nsIOService::Init()
 {
     nsresult rv;
 
@@ -185,30 +182,28 @@ nsIOService::Init()
     nsCOMPtr<nsIPrefBranch> prefBranch;
     GetPrefBranch(getter_AddRefs(prefBranch));
     if (prefBranch) {
         prefBranch->AddObserver(PORT_PREF_PREFIX, this, true);
         prefBranch->AddObserver(AUTODIAL_PREF, this, true);
         prefBranch->AddObserver(MANAGE_OFFLINE_STATUS_PREF, this, true);
         prefBranch->AddObserver(NECKO_BUFFER_CACHE_COUNT_PREF, this, true);
         prefBranch->AddObserver(NECKO_BUFFER_CACHE_SIZE_PREF, this, true);
-        prefBranch->AddObserver(NETWORK_NOTIFY_CHANGED_PREF, this, true);
         PrefsChanged(prefBranch);
     }
     
     // Register for profile change notifications
     nsCOMPtr<nsIObserverService> observerService =
         mozilla::services::GetObserverService();
     if (observerService) {
         observerService->AddObserver(this, kProfileChangeNetTeardownTopic, true);
         observerService->AddObserver(this, kProfileChangeNetRestoreTopic, true);
         observerService->AddObserver(this, kProfileDoChange, true);
         observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
         observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, true);
-        observerService->AddObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC, true);
     }
     else
         NS_WARNING("failed to get observer service");
 
     gIOService = this;
 
     InitializeNetworkLinkService();
 
@@ -265,19 +260,20 @@ nsIOService::InitializeNetworkLinkServic
     if (mNetworkLinkService) {
         mNetworkLinkServiceInitialized = true;
     }
     else {
         // We can't really determine if the machine has a usable network connection,
         // so let's cross our fingers!
         mManageOfflineStatus = false;
     }
+   
 
     if (mManageOfflineStatus)
-        OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN);
+        TrackNetworkLinkStatusForOffline();
     else
         SetOffline(false);
     
     return rv;
 }
 
 nsIOService*
 nsIOService::GetInstance() {
@@ -850,24 +846,16 @@ nsIOService::PrefsChanged(nsIPrefBranch 
              * the upper limit here is arbitrary. having a 1mb segment size
              * is pretty crazy.  if you remove this, consider adding some
              * integer rollover test.
              */
             if (size > 0 && size < 1024*1024)
                 gDefaultSegmentSize = size;
         NS_WARN_IF_FALSE( (!(size & (size - 1))) , "network segment size is not a power of 2!");
     }
-
-    if (!pref || strcmp(pref, NETWORK_NOTIFY_CHANGED_PREF) == 0) {
-        bool allow;
-        nsresult rv = prefs->GetBoolPref(NETWORK_NOTIFY_CHANGED_PREF, &allow);
-        if (NS_SUCCEEDED(rv)) {
-            mNetworkNotifyChanged = allow;
-        }
-    }
 }
 
 void
 nsIOService::ParsePortList(nsIPrefBranch *prefBranch, const char *pref, bool remove)
 {
     nsXPIDLCString portList;
 
     // Get a pref string and chop it up into a list of ports.
@@ -918,70 +906,62 @@ NS_IMETHODIMP
 nsIOService::Observe(nsISupports *subject,
                      const char *topic,
                      const char16_t *data)
 {
     if (!strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
         nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(subject);
         if (prefBranch)
             PrefsChanged(prefBranch, NS_ConvertUTF16toUTF8(data).get());
-    } else if (!strcmp(topic, kProfileChangeNetTeardownTopic)) {
+    }
+    else if (!strcmp(topic, kProfileChangeNetTeardownTopic)) {
         if (!mOffline) {
             mOfflineForProfileChange = true;
             SetOffline(true);
         }
-    } else if (!strcmp(topic, kProfileChangeNetRestoreTopic)) {
+    }
+    else if (!strcmp(topic, kProfileChangeNetRestoreTopic)) {
         if (mOfflineForProfileChange) {
             mOfflineForProfileChange = false;
             if (!mManageOfflineStatus ||
-                NS_FAILED(OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN))) {
+                NS_FAILED(TrackNetworkLinkStatusForOffline())) {
                 SetOffline(false);
             }
         } 
-    } else if (!strcmp(topic, kProfileDoChange)) { 
+    } 
+    else if (!strcmp(topic, kProfileDoChange)) { 
         if (data && NS_LITERAL_STRING("startup").Equals(data)) {
             // Lazy initialization of network link service (see bug 620472)
             InitializeNetworkLinkService();
             // Set up the initilization flag regardless the actuall result.
             // If we fail here, we will fail always on.
             mNetworkLinkServiceInitialized = true;
             // And now reflect the preference setting
             nsCOMPtr<nsIPrefBranch> prefBranch;
             GetPrefBranch(getter_AddRefs(prefBranch));
             PrefsChanged(prefBranch, MANAGE_OFFLINE_STATUS_PREF);
         }
-    } else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
+    }
+    else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
         // Remember we passed XPCOM shutdown notification to prevent any
         // changes of the offline status from now. We must not allow going
         // online after this point.
         mShutdown = true;
 
         SetOffline(true);
 
         // Break circular reference.
         mProxyService = nullptr;
-    } else if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
-        if (!mOfflineForProfileChange) {
-            OnNetworkLinkEvent(NS_ConvertUTF16toUTF8(data).get());
-        }
-    } else if (!strcmp(topic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) {
-        // coming back alive from sleep
-        nsCOMPtr<nsIObserverService> observerService =
-            mozilla::services::GetObserverService();
-
-        NS_ASSERTION(observerService, "The observer service should not be null");
-
-        if (observerService && mNetworkNotifyChanged) {
-            (void)observerService->
-                NotifyObservers(nullptr,
-                                NS_NETWORK_LINK_TOPIC,
-                                MOZ_UTF16(NS_NETWORK_LINK_DATA_CHANGED));
+    }
+    else if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
+        if (!mOfflineForProfileChange && mManageOfflineStatus) {
+            TrackNetworkLinkStatusForOffline();
         }
     }
-
+    
     return NS_OK;
 }
 
 // nsINetUtil interface
 NS_IMETHODIMP
 nsIOService::ParseContentType(const nsACString &aTypeHeader,
                               nsACString &aCharset,
                               bool *aHadCharset,
@@ -1069,98 +1049,81 @@ nsIOService::NewSimpleNestedURI(nsIURI* 
     nsresult rv = NS_EnsureSafeToReturn(aURI, getter_AddRefs(safeURI));
     NS_ENSURE_SUCCESS(rv, rv);
 
     NS_IF_ADDREF(*aResult = new nsSimpleNestedURI(safeURI));
     return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 NS_IMETHODIMP
-nsIOService::SetManageOfflineStatus(bool aManage)
-{
+nsIOService::SetManageOfflineStatus(bool aManage) {
     nsresult rv = NS_OK;
 
     // SetManageOfflineStatus must throw when we fail to go from non-managed
-    // to managed.  Usually because there is no link monitoring service
-    // available.  Failure to do this switch is detected by a failure of
-    // OnNetworkLinkEvent().  When there is no network link available during
-    // call to InitializeNetworkLinkService(), application is put to offline
-    // mode.  And when we change mMangeOfflineStatus to false on the next line
-    // we get stuck on being offline even though the link becomes later
-    // available.
+    // to managed.  Usually because there is no link monitoring service 
+    // available.  Failure to do this switch is detected by a failure of 
+    // TrackNetworkLinkStatusForOffline().  When there is no network link 
+    // available during call to InitializeNetworkLinkService(), application is
+    // put to offline mode.  And when we change mMangeOfflineStatus to false 
+    // on the next line we get stuck on being offline even though the link 
+    // becomes later available.
     bool wasManaged = mManageOfflineStatus;
     mManageOfflineStatus = aManage;
 
     InitializeNetworkLinkService();
 
     if (mManageOfflineStatus && !wasManaged) {
-        rv = OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN);
+        rv = TrackNetworkLinkStatusForOffline();
         if (NS_FAILED(rv))
             mManageOfflineStatus = false;
     }
     return rv;
 }
 
 NS_IMETHODIMP
 nsIOService::GetManageOfflineStatus(bool* aManage) {
     *aManage = mManageOfflineStatus;
     return NS_OK;
 }
 
-// input argument 'data' is already UTF8'ed
 nsresult
-nsIOService::OnNetworkLinkEvent(const char *data)
+nsIOService::TrackNetworkLinkStatusForOffline()
 {
+    NS_ASSERTION(mManageOfflineStatus,
+                 "Don't call this unless we're managing the offline status");
     if (!mNetworkLinkService)
         return NS_ERROR_FAILURE;
 
     if (mShutdown)
         return NS_ERROR_NOT_AVAILABLE;
-
-    if (mManageOfflineStatus)
-        return NS_OK;
-
-    if (!strcmp(data, NS_NETWORK_LINK_DATA_DOWN)) {
-        // check to make sure this won't collide with Autodial
-        if (mSocketTransportService) {
-            bool autodialEnabled = false;
-            mSocketTransportService->GetAutodialEnabled(&autodialEnabled);
-            // If autodialing-on-link-down is enabled, check if the OS auto
-            // dial option is set to always autodial. If so, then we are
-            // always up for the purposes of offline management.
-            if (autodialEnabled) {
+  
+    // check to make sure this won't collide with Autodial
+    if (mSocketTransportService) {
+        bool autodialEnabled = false;
+        mSocketTransportService->GetAutodialEnabled(&autodialEnabled);
+        // If autodialing-on-link-down is enabled, check if the OS auto dial 
+        // option is set to always autodial. If so, then we are 
+        // always up for the purposes of offline management.
+        if (autodialEnabled) {
 #if defined(XP_WIN)
-                // On Windows, we should first check with the OS to see if
-                // autodial is enabled.  If it is enabled then we are allowed
-                // to manage the offline state.
-                if (nsNativeConnectionHelper::IsAutodialEnabled()) {
-                    return SetOffline(false);
-                }
+            // On Windows, we should first check with the OS
+            // to see if autodial is enabled.  If it is
+            // enabled then we are allowed to manage the
+            // offline state.
+            if(nsNativeConnectionHelper::IsAutodialEnabled()) 
+                return SetOffline(false);
 #else
-                return SetOffline(false);
+            return SetOffline(false);
 #endif
-            }
         }
     }
 
     bool isUp;
-    if (!strcmp(data, NS_NETWORK_LINK_DATA_DOWN)) {
-        isUp = false;
-    } else if (!strcmp(data, NS_NETWORK_LINK_DATA_UP)) {
-        isUp = true;
-    } else if (!strcmp(data, NS_NETWORK_LINK_DATA_CHANGED)) {
-        // CHANGED events are handled by others
-        return NS_OK;
-    } else if (!strcmp(data, NS_NETWORK_LINK_DATA_UNKNOWN)) {
-        nsresult rv = mNetworkLinkService->GetIsLinkUp(&isUp);
-        NS_ENSURE_SUCCESS(rv, rv);
-    } else {
-        NS_WARNING("Unhandled network event!");
-        return NS_OK;
-    }
+    nsresult rv = mNetworkLinkService->GetIsLinkUp(&isUp);
+    NS_ENSURE_SUCCESS(rv, rv);
     return SetOffline(!isUp);
 }
 
 NS_IMETHODIMP
 nsIOService::EscapeString(const nsACString& aString,
                           uint32_t aEscapeType,
                           nsACString& aResult)
 {
--- a/netwerk/base/src/nsIOService.h
+++ b/netwerk/base/src/nsIOService.h
@@ -76,17 +76,17 @@ public:
 
 private:
     // These shouldn't be called directly:
     // - construct using GetInstance
     // - destroy using Release
     nsIOService();
     ~nsIOService();
 
-    nsresult OnNetworkLinkEvent(const char *data);
+    nsresult TrackNetworkLinkStatusForOffline();
 
     nsresult GetCachedProtocolHandler(const char *scheme,
                                                   nsIProtocolHandler* *hdlrResult,
                                                   uint32_t start=0,
                                                   uint32_t end=0);
     nsresult CacheProtocolHandler(const char *scheme,
                                               nsIProtocolHandler* hdlr);
 
@@ -124,17 +124,16 @@ private:
     nsWeakPtr                            mWeakHandler[NS_N(gScheme)];
 
     // cached categories
     nsCategoryCache<nsIChannelEventSink> mChannelEventSinks;
 
     nsTArray<int32_t>                    mRestrictedPortList;
 
     bool                                 mAutoDialEnabled;
-    bool                                 mNetworkNotifyChanged;
 public:
     // Used for all default buffer sizes that necko allocates.
     static uint32_t   gDefaultSegmentSize;
     static uint32_t   gDefaultSegmentCount;
 };
 
 /**
  * Reference to the IO service singleton. May be null.
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -24,17 +24,16 @@
 #include "nsNetUtil.h"
 #include "nsNetCID.h"
 #include "prnetdb.h"
 #include "nsPACMan.h"
 #include "nsProxyRelease.h"
 #include "mozilla/Mutex.h"
 #include "mozilla/CondVar.h"
 #include "nsISystemProxySettings.h"
-#include "nsINetworkLinkService.h"
 
 //----------------------------------------------------------------------------
 
 namespace mozilla {
   extern const char kProxyType_HTTP[];
   extern const char kProxyType_HTTPS[];
   extern const char kProxyType_SOCKS[];
   extern const char kProxyType_SOCKS4[];
@@ -410,25 +409,21 @@ nsProtocolProxyService::Init()
     if (prefBranch) {
         // monitor proxy prefs
         prefBranch->AddObserver(PROXY_PREF_BRANCH, this, false);
 
         // read all prefs
         PrefsChanged(prefBranch, nullptr);
     }
 
+    // register for shutdown notification so we can clean ourselves up properly.
     nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-    if (obs) {
-        // register for shutdown notification so we can clean ourselves up
-        // properly.
+    if (obs)
         obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
 
-        obs->AddObserver(this, NS_NETWORK_LINK_TOPIC, false);
-    }
-
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsProtocolProxyService::Observe(nsISupports     *aSubject,
                                 const char      *aTopic,
                                 const char16_t *aData)
 {
@@ -440,23 +435,16 @@ nsProtocolProxyService::Observe(nsISuppo
         if (mFilters) {
             delete mFilters;
             mFilters = nullptr;
         }
         if (mPACMan) {
             mPACMan->Shutdown();
             mPACMan = nullptr;
         }
-    } else if (strcmp(aTopic, NS_NETWORK_LINK_TOPIC) == 0) {
-        nsCString converted = NS_ConvertUTF16toUTF8(aData);
-        const char *state = converted.get();
-        if (strcmp(state, NS_NETWORK_LINK_DATA_CHANGED) == 0) {
-            LOG((": received network event: %s, reload PAC", state));
-            ReloadPAC();
-        }
     }
     else {
         NS_ASSERTION(strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0,
                      "what is this random observer event?");
         nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(aSubject);
         if (prefs)
             PrefsChanged(prefs, NS_LossyConvertUTF16toASCII(aData).get());
     }
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -25,25 +25,22 @@
 #include "prnetdb.h"
 #include "prmon.h"
 #include "prio.h"
 #include "plstr.h"
 #include "nsIOService.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "nsNetAddr.h"
 #include "nsProxyRelease.h"
-#include "nsIObserverService.h"
-#include "nsINetworkLinkService.h"
 
 #include "mozilla/Attributes.h"
 #include "mozilla/VisualEventTracer.h"
 #include "mozilla/net/NeckoCommon.h"
 #include "mozilla/net/ChildDNSService.h"
 #include "mozilla/net/DNSListenerProxy.h"
-#include "mozilla/Services.h"
 
 using namespace mozilla;
 using namespace mozilla::net;
 
 static const char kPrefDnsCacheEntries[]     = "network.dnsCacheEntries";
 static const char kPrefDnsCacheExpiration[]  = "network.dnsCacheExpiration";
 static const char kPrefDnsCacheGrace[]       = "network.dnsCacheExpirationGracePeriod";
 static const char kPrefIPv4OnlyDomains[]     = "network.dns.ipv4OnlyDomains";
@@ -538,23 +535,22 @@ nsDNSService::Init()
             prefs->AddObserver(kPrefDisablePrefetch, this, false);
             prefs->AddObserver(kPrefDnsNotifyResolution, this, false);
 
             // Monitor these to see if there is a change in proxy configuration
             // If a manual proxy is in use, disable prefetch implicitly
             prefs->AddObserver("network.proxy.type", this, false);
         }
 
+        nsresult rv;
         nsCOMPtr<nsIObserverService> observerService =
-            mozilla::services::GetObserverService();
-        if (observerService) {
+            do_GetService("@mozilla.org/observer-service;1", &rv);
+        if (NS_SUCCEEDED(rv)) {
             observerService->AddObserver(this, "last-pb-context-exited", false);
-            observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, false);
         }
-
     }
 
     nsDNSPrefetch::Initialize(this);
 
     // Don't initialize the resolver if we're in offline mode.
     // Later on, the IO service will reinitialize us when going online.
     if (gIOService->IsOffline() && !gIOService->IsComingOnline())
         return NS_OK;
@@ -869,31 +865,20 @@ nsDNSService::GetMyHostName(nsACString &
         return NS_OK;
     }
     return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsDNSService::Observe(nsISupports *subject, const char *topic, const char16_t *data)
 {
-    // We are only getting called if a preference has changed or there's a
-    // network link event.
+    // we are only getting called if a preference has changed. 
     NS_ASSERTION(strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0 ||
-                 strcmp(topic, "last-pb-context-exited") == 0 ||
-                 strcmp(topic, NS_NETWORK_LINK_TOPIC) == 0,
-                 "unexpected observe call");
-
-    if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) {
-        nsCString converted = NS_ConvertUTF16toUTF8(data);
-        const char *state = converted.get();
-        if (!strcmp(state, NS_NETWORK_LINK_DATA_CHANGED)) {
-            mResolver->FlushCache();
-        }
-        return NS_OK;
-    }
+        strcmp(topic, "last-pb-context-exited") == 0,
+        "unexpected observe call");
 
     //
     // Shutdown and this function are both only called on the UI thread, so we don't
     // have to worry about mResolver being cleared out from under us.
     //
     // NOTE Shutting down and reinitializing the service like this is obviously
     // suboptimal if Observe gets called several times in a row, but we don't
     // expect that to be the case.
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -473,64 +473,57 @@ nsHostResolver::ClearPendingQueue(PRCLis
             nsHostRecord *rec = static_cast<nsHostRecord *>(node);
             node = node->next;
             OnLookupComplete(rec, NS_ERROR_ABORT, nullptr);
         }
     }
 }
 
 void
-nsHostResolver::FlushCache()
+nsHostResolver::Shutdown()
 {
+    LOG(("Shutting down host resolver.\n"));
+
     PRCList pendingQHigh, pendingQMed, pendingQLow, evictionQ;
     PR_INIT_CLIST(&pendingQHigh);
     PR_INIT_CLIST(&pendingQMed);
     PR_INIT_CLIST(&pendingQLow);
     PR_INIT_CLIST(&evictionQ);
 
     {
         MutexAutoLock lock(mLock);
+        
+        mShutdown = true;
+
         MoveCList(mHighQ, pendingQHigh);
         MoveCList(mMediumQ, pendingQMed);
         MoveCList(mLowQ, pendingQLow);
         MoveCList(mEvictionQ, evictionQ);
         mEvictionQSize = 0;
         mPendingCount = 0;
-
+        
         if (mNumIdleThreads)
             mIdleThreadCV.NotifyAll();
-
+        
         // empty host database
         PL_DHashTableEnumerate(&mDB, HostDB_RemoveEntry, nullptr);
     }
-
+    
     ClearPendingQueue(&pendingQHigh);
     ClearPendingQueue(&pendingQMed);
     ClearPendingQueue(&pendingQLow);
 
     if (!PR_CLIST_IS_EMPTY(&evictionQ)) {
         PRCList *node = evictionQ.next;
         while (node != &evictionQ) {
             nsHostRecord *rec = static_cast<nsHostRecord *>(node);
             node = node->next;
             NS_RELEASE(rec);
         }
     }
-}
-
-void
-nsHostResolver::Shutdown()
-{
-    LOG(("Shutting down host resolver.\n"));
-
-    {
-        MutexAutoLock lock(mLock);
-        mShutdown = true;
-    }
-    FlushCache();
 
 #ifdef NS_BUILD_REFCNT_LOGGING
     
     // Logically join the outstanding worker threads with a timeout.
     // Use this approach instead of PR_JoinThread() because that does 
     // not allow a timeout which may be necessary for a semi-responsive 
     // shutdown if the thread is blocked on a very slow DNS resolution.
     // mThreadCount is read outside of mLock, but the worst case 
--- a/netwerk/dns/nsHostResolver.h
+++ b/netwerk/dns/nsHostResolver.h
@@ -233,21 +233,16 @@ public:
         RES_PRIORITY_LOW  = 1 << 3,
         RES_SPECULATE     = 1 << 4,
         //RES_DISABLE_IPV6 = 1 << 5, // Not used
         RES_OFFLINE       = 1 << 6
     };
 
     size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
 
-    /**
-     * Flush the DNS cache.
-     */
-    void FlushCache();
-
 private:
    explicit nsHostResolver(uint32_t maxCacheEntries = 50, uint32_t maxCacheLifetime = 60,
                             uint32_t lifetimeGracePeriod = 0);
    ~nsHostResolver();
 
     nsresult Init();
     nsresult IssueLookup(nsHostRecord *);
     bool     GetHostToLookup(nsHostRecord **m);
--- a/netwerk/protocol/http/ASpdySession.h
+++ b/netwerk/protocol/http/ASpdySession.h
@@ -34,18 +34,16 @@ public:
   static ASpdySession *NewSpdySession(uint32_t version, nsISocketTransport *);
 
   virtual void PrintDiagnostics (nsCString &log) = 0;
 
   bool ResponseTimeoutEnabled() const MOZ_OVERRIDE MOZ_FINAL {
     return true;
   }
 
-  virtual void SendPing() = 0;
-
   const static uint32_t kSendingChunkSize = 4095;
   const static uint32_t kTCPSendBufferSize = 131072;
 
   // until we have an API that can push back on receiving data (right now
   // WriteSegments is obligated to accept data and buffer) there is no
   // reason to throttle with the rwin other than in server push
   // scenarios.
   const static uint32_t kInitialRwin = 256 * 1024 * 1024;
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -93,17 +93,16 @@ Http2Session::Http2Session(nsISocketTran
   , mServerInitialStreamWindow(kDefaultRwin)
   , mLocalSessionWindow(kDefaultRwin)
   , mServerSessionWindow(kDefaultRwin)
   , mOutputQueueSize(kDefaultQueueSize)
   , mOutputQueueUsed(0)
   , mOutputQueueSent(0)
   , mLastReadEpoch(PR_IntervalNow())
   , mPingSentEpoch(0)
-  , mPreviousUsed(false)
   , mWaitingForSettingsAck(false)
   , mGoAwayOnPush(false)
 {
   MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   static uint64_t sSerial;
   mSerial = ++sSerial;
 
@@ -289,24 +288,18 @@ Http2Session::ReadTimeoutTick(PRInterval
   LOG3(("Http2Session::ReadTimeoutTick %p delta since last read %ds\n",
        this, PR_IntervalToSeconds(now - mLastReadEpoch)));
 
   if (!mPingThreshold)
     return UINT32_MAX;
 
   if ((now - mLastReadEpoch) < mPingThreshold) {
     // recent activity means ping is not an issue
-    if (mPingSentEpoch) {
+    if (mPingSentEpoch)
       mPingSentEpoch = 0;
-      if (mPreviousUsed) {
-        // restore the former value
-        mPingThreshold = mPreviousPingThreshold;
-        mPreviousUsed = false;
-      }
-    }
 
     return PR_IntervalToSeconds(mPingThreshold) -
       PR_IntervalToSeconds(now - mLastReadEpoch);
   }
 
   if (mPingSentEpoch) {
     LOG3(("Http2Session::ReadTimeoutTick %p handle outstanding ping\n"));
     if ((now - mPingSentEpoch) >= gHttpHandler->SpdyPingTimeout()) {
@@ -316,19 +309,18 @@ Http2Session::ReadTimeoutTick(PRInterval
       return UINT32_MAX;
     }
     return 1; // run the tick aggressively while ping is outstanding
   }
 
   LOG3(("Http2Session::ReadTimeoutTick %p generating ping\n", this));
 
   mPingSentEpoch = PR_IntervalNow();
-  if (!mPingSentEpoch) {
+  if (!mPingSentEpoch)
     mPingSentEpoch = 1; // avoid the 0 sentinel value
-  }
   GeneratePing(false);
   ResumeRecv(); // read the ping reply
 
   // Check for orphaned push streams. This looks expensive, but generally the
   // list is empty.
   Http2PushedStream *deleteMe;
   TimeStamp timestampNow;
   do {
@@ -3296,34 +3288,10 @@ Http2Session::IsReused()
 }
 
 nsresult
 Http2Session::PushBack(const char *buf, uint32_t len)
 {
   return mConnection->PushBack(buf, len);
 }
 
-void
-Http2Session::SendPing()
-{
-  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-
-  if (mPreviousUsed) {
-    // alredy in progress, get out
-    return;
-  }
-
-  mPingSentEpoch = PR_IntervalNow();
-  if (!mPingSentEpoch) {
-    mPingSentEpoch = 1; // avoid the 0 sentinel value
-  }
-  if (!mPingThreshold ||
-      (mPingThreshold > gHttpHandler->NetworkChangedTimeout())) {
-    mPreviousPingThreshold = mPingThreshold;
-    mPreviousUsed = true;
-    mPingThreshold = gHttpHandler->NetworkChangedTimeout();
-  }
-  GeneratePing(false);
-  ResumeRecv();
-}
-
 } // namespace mozilla::net
 } // namespace mozilla
--- a/netwerk/protocol/http/Http2Session.h
+++ b/netwerk/protocol/http/Http2Session.h
@@ -207,18 +207,16 @@ public:
   // Streams need access to these
   uint32_t SendingChunkSize() { return mSendingChunkSize; }
   uint32_t PushAllowance() { return mPushAllowance; }
   Http2Compressor *Compressor() { return &mCompressor; }
   nsISocketTransport *SocketTransport() { return mSocketTransport; }
   int64_t ServerSessionWindow() { return mServerSessionWindow; }
   void DecrementServerSessionWindow (uint32_t bytes) { mServerSessionWindow -= bytes; }
 
-  void SendPing() MOZ_OVERRIDE;
-
 private:
 
   // These internal states do not correspond to the states of the HTTP/2 specification
   enum internalStateType {
     BUFFERING_OPENING_SETTINGS,
     BUFFERING_FRAME_HEADER,
     BUFFERING_CONTROL_FRAME,
     PROCESSING_DATA_FRAME_PADDING_CONTROL,
@@ -438,19 +436,16 @@ private:
   uint32_t             mOutputQueueSent;
   nsAutoArrayPtr<char> mOutputQueueBuffer;
 
   PRIntervalTime       mPingThreshold;
   PRIntervalTime       mLastReadEpoch;     // used for ping timeouts
   PRIntervalTime       mLastDataReadEpoch; // used for IdleTime()
   PRIntervalTime       mPingSentEpoch;
 
-  PRIntervalTime       mPreviousPingThreshold; // backup for the former value
-  bool                 mPreviousUsed;          // true when backup is used
-
   // used as a temporary buffer while enumerating the stream hash during GoAway
   nsDeque  mGoAwayStreamsToRestart;
 
   // Each session gets a unique serial number because the push cache is correlated
   // by the load group and the serial number can be used as part of the cache key
   // to make sure streams aren't shared across sessions.
   uint64_t        mSerial;
 
--- a/netwerk/protocol/http/SpdySession3.cpp
+++ b/netwerk/protocol/http/SpdySession3.cpp
@@ -68,17 +68,16 @@ SpdySession3::SpdySession3(nsISocketTran
   , mServerPushedResources(0)
   , mServerInitialWindow(kDefaultServerRwin)
   , mOutputQueueSize(kDefaultQueueSize)
   , mOutputQueueUsed(0)
   , mOutputQueueSent(0)
   , mLastReadEpoch(PR_IntervalNow())
   , mPingSentEpoch(0)
   , mNextPingID(1)
-  , mPreviousUsed(false)
 {
   MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   static uint64_t sSerial;
   mSerial = ++sSerial;
 
   LOG3(("SpdySession3::SpdySession3 %p serial=0x%X\n", this, mSerial));
 
@@ -220,24 +219,18 @@ SpdySession3::ReadTimeoutTick(PRInterval
     LOG(("SpdySession3::ReadTimeoutTick %p delta since last read %ds\n",
          this, PR_IntervalToSeconds(now - mLastReadEpoch)));
 
     if (!mPingThreshold)
       return UINT32_MAX;
 
     if ((now - mLastReadEpoch) < mPingThreshold) {
       // recent activity means ping is not an issue
-      if (mPingSentEpoch) {
+      if (mPingSentEpoch)
         mPingSentEpoch = 0;
-        if (mPreviousUsed) {
-          // restore the former value
-          mPingThreshold = mPreviousPingThreshold;
-          mPreviousUsed = false;
-        }
-      }
 
       return PR_IntervalToSeconds(mPingThreshold) -
         PR_IntervalToSeconds(now - mLastReadEpoch);
     }
 
     if (mPingSentEpoch) {
       LOG(("SpdySession3::ReadTimeoutTick %p handle outstanding ping\n"));
       if ((now - mPingSentEpoch) >= gHttpHandler->SpdyPingTimeout()) {
@@ -2815,39 +2808,10 @@ SpdySession3::IsReused()
 }
 
 nsresult
 SpdySession3::PushBack(const char *buf, uint32_t len)
 {
   return mConnection->PushBack(buf, len);
 }
 
-void
-SpdySession3::SendPing()
-{
-  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-
-  if (mPreviousUsed) {
-    // alredy in progress, get out
-    return;
-  }
-
-  mPingSentEpoch = PR_IntervalNow();
-  if (!mPingSentEpoch) {
-    mPingSentEpoch = 1; // avoid the 0 sentinel value
-  }
-  if (!mPingThreshold ||
-      (mPingThreshold > gHttpHandler->NetworkChangedTimeout())) {
-    mPreviousPingThreshold = mPingThreshold;
-    mPreviousUsed = true;
-    mPingThreshold = gHttpHandler->NetworkChangedTimeout();
-  }
-
-  GeneratePing(mNextPingID);
-  mNextPingID += 2;
-  ResumeRecv();
-
-  gHttpHandler->ConnMgr()->ActivateTimeoutTick();
-}
-
-
 } // namespace mozilla::net
 } // namespace mozilla
--- a/netwerk/protocol/http/SpdySession3.h
+++ b/netwerk/protocol/http/SpdySession3.h
@@ -184,18 +184,16 @@ public:
   void     PrintDiagnostics (nsCString &log);
 
   // Streams need access to these
   uint32_t SendingChunkSize() { return mSendingChunkSize; }
   uint32_t PushAllowance() { return mPushAllowance; }
   z_stream *UpstreamZlib() { return &mUpstreamZlib; }
   nsISocketTransport *SocketTransport() { return mSocketTransport; }
 
-  void SendPing() MOZ_OVERRIDE;
-
 private:
 
   enum stateType {
     BUFFERING_FRAME_HEADER,
     BUFFERING_CONTROL_FRAME,
     PROCESSING_DATA_FRAME,
     DISCARDING_DATA_FRAME,
     PROCESSING_COMPLETE_HEADERS,
@@ -375,19 +373,16 @@ private:
   nsAutoArrayPtr<char> mOutputQueueBuffer;
 
   PRIntervalTime       mPingThreshold;
   PRIntervalTime       mLastReadEpoch;     // used for ping timeouts
   PRIntervalTime       mLastDataReadEpoch; // used for IdleTime()
   PRIntervalTime       mPingSentEpoch;
   uint32_t             mNextPingID;
 
-  PRIntervalTime       mPreviousPingThreshold; // backup for the former value
-  bool                 mPreviousUsed;          // true when backup is used
-
   // used as a temporary buffer while enumerating the stream hash during GoAway
   nsDeque  mGoAwayStreamsToRestart;
 
   // Each session gets a unique serial number because the push cache is correlated
   // by the load group and the serial number can be used as part of the cache key
   // to make sure streams aren't shared across sessions.
   uint64_t        mSerial;
 
--- a/netwerk/protocol/http/SpdySession31.cpp
+++ b/netwerk/protocol/http/SpdySession31.cpp
@@ -70,17 +70,16 @@ SpdySession31::SpdySession31(nsISocketTr
   , mLocalSessionWindow(kDefaultRwin)
   , mRemoteSessionWindow(kDefaultRwin)
   , mOutputQueueSize(kDefaultQueueSize)
   , mOutputQueueUsed(0)
   , mOutputQueueSent(0)
   , mLastReadEpoch(PR_IntervalNow())
   , mPingSentEpoch(0)
   , mNextPingID(1)
-  , mPreviousUsed(false)
 {
   MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
   static uint64_t sSerial;
   mSerial = ++sSerial;
 
   LOG3(("SpdySession31::SpdySession31 %p serial=0x%X\n", this, mSerial));
 
@@ -223,24 +222,18 @@ SpdySession31::ReadTimeoutTick(PRInterva
   LOG(("SpdySession31::ReadTimeoutTick %p delta since last read %ds\n",
        this, PR_IntervalToSeconds(now - mLastReadEpoch)));
 
   if (!mPingThreshold)
     return UINT32_MAX;
 
   if ((now - mLastReadEpoch) < mPingThreshold) {
     // recent activity means ping is not an issue
-    if (mPingSentEpoch) {
+    if (mPingSentEpoch)
       mPingSentEpoch = 0;
-      if (mPreviousUsed) {
-        // restore the former value
-        mPingThreshold = mPreviousPingThreshold;
-        mPreviousUsed = false;
-      }
-    }
 
     return PR_IntervalToSeconds(mPingThreshold) -
       PR_IntervalToSeconds(now - mLastReadEpoch);
   }
 
   if (mPingSentEpoch) {
     LOG(("SpdySession31::ReadTimeoutTick %p handle outstanding ping\n", this));
     if ((now - mPingSentEpoch) >= gHttpHandler->SpdyPingTimeout()) {
@@ -2959,38 +2952,10 @@ SpdySession31::IsReused()
 }
 
 nsresult
 SpdySession31::PushBack(const char *buf, uint32_t len)
 {
   return mConnection->PushBack(buf, len);
 }
 
-void
-SpdySession31::SendPing()
-{
-  MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-
-  if (mPreviousUsed) {
-    // alredy in progress, get out
-    return;
-  }
-
-  mPingSentEpoch = PR_IntervalNow();
-  if (!mPingSentEpoch) {
-    mPingSentEpoch = 1; // avoid the 0 sentinel value
-  }
-  if (!mPingThreshold ||
-      (mPingThreshold >  gHttpHandler->NetworkChangedTimeout())) {
-    mPreviousPingThreshold = mPingThreshold;
-    mPreviousUsed = true;
-    mPingThreshold = gHttpHandler->NetworkChangedTimeout();
-  }
-
-  GeneratePing(mNextPingID);
-  mNextPingID += 2;
-  ResumeRecv();
-
-  gHttpHandler->ConnMgr()->ActivateTimeoutTick();
-}
-
 } // namespace mozilla::net
 } // namespace mozilla
--- a/netwerk/protocol/http/SpdySession31.h
+++ b/netwerk/protocol/http/SpdySession31.h
@@ -188,18 +188,16 @@ public:
   // Streams need access to these
   uint32_t SendingChunkSize() { return mSendingChunkSize; }
   uint32_t PushAllowance() { return mPushAllowance; }
   z_stream *UpstreamZlib() { return &mUpstreamZlib; }
   nsISocketTransport *SocketTransport() { return mSocketTransport; }
   int64_t RemoteSessionWindow() { return mRemoteSessionWindow; }
   void DecrementRemoteSessionWindow (uint32_t bytes) { mRemoteSessionWindow -= bytes; }
 
-  void SendPing() MOZ_OVERRIDE;
-
 private:
 
   enum stateType {
     BUFFERING_FRAME_HEADER,
     BUFFERING_CONTROL_FRAME,
     PROCESSING_DATA_FRAME,
     DISCARDING_DATA_FRAME,
     PROCESSING_COMPLETE_HEADERS,
@@ -394,19 +392,16 @@ private:
   nsAutoArrayPtr<char> mOutputQueueBuffer;
 
   PRIntervalTime       mPingThreshold;
   PRIntervalTime       mLastReadEpoch;     // used for ping timeouts
   PRIntervalTime       mLastDataReadEpoch; // used for IdleTime()
   PRIntervalTime       mPingSentEpoch;
   uint32_t             mNextPingID;
 
-  PRIntervalTime       mPreviousPingThreshold; // backup for the former value
-  bool                 mPreviousUsed;          // true when backup is used
-
   // used as a temporary buffer while enumerating the stream hash during GoAway
   nsDeque  mGoAwayStreamsToRestart;
 
   // Each session gets a unique serial number because the push cache is correlated
   // by the load group and the serial number can be used as part of the cache key
   // to make sure streams aren't shared across sessions.
   uint64_t        mSerial;
 
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -64,17 +64,16 @@ nsHttpConnection::nsHttpConnection()
     , mIsReused(false)
     , mCompletedProxyConnect(false)
     , mLastTransactionExpectedNoContent(false)
     , mIdleMonitoring(false)
     , mProxyConnectInProgress(false)
     , mExperienced(false)
     , mInSpdyTunnel(false)
     , mForcePlainText(false)
-    , mTrafficStamp(false)
     , mHttp1xTransactionCount(0)
     , mRemainingConnectionUses(0xffffffff)
     , mClassification(nsAHttpTransaction::CLASS_GENERAL)
     , mNPNComplete(false)
     , mSetupSSLCalled(false)
     , mUsingSpdyVersion(0)
     , mPriority(nsISupportsPriority::PRIORITY_NORMAL)
     , mReportedSpdy(false)
@@ -2076,28 +2075,10 @@ nsHttpConnection::GetInterface(const nsI
         MutexAutoLock lock(mCallbacksLock);
         callbacks = mCallbacks;
     }
     if (callbacks)
         return callbacks->GetInterface(iid, result);
     return NS_ERROR_NO_INTERFACE;
 }
 
-void
-nsHttpConnection::CheckForTraffic(bool check)
-{
-    if (check) {
-        if (mSpdySession) {
-            // Send a ping to verify it is still alive
-            mSpdySession->SendPing();
-        } else {
-            // If not SPDY, Store snapshot amount of data right now
-            mTrafficCount = mTotalBytesWritten + mTotalBytesRead;
-            mTrafficStamp = true;
-        }
-    } else {
-        // mark it as not checked
-        mTrafficStamp = false;
-    }
-}
-
 } // namespace mozilla::net
 } // namespace mozilla
--- a/netwerk/protocol/http/nsHttpConnection.h
+++ b/netwerk/protocol/http/nsHttpConnection.h
@@ -195,30 +195,16 @@ public:
     bool    IsExperienced() { return mExperienced; }
 
     static nsresult MakeConnectString(nsAHttpTransaction *trans,
                                       nsHttpRequestHead *request,
                                       nsACString &result);
     void    SetupSecondaryTLS();
     void    SetInSpdyTunnel(bool arg);
 
-    // Returns true if the socket peer has a private (RFC1918-like) address.
-    bool    PeerHasPrivateIP();
-    // Check active connections for traffic (or not). SPDY connections send a
-    // ping, ordinary HTTP connections get some time to get traffic to be
-    // considered alive.
-    void CheckForTraffic(bool check);
-
-    // NoTraffic() returns true if there's been no traffic on the (non-spdy)
-    // connection since CheckForTraffic() was called.
-    bool NoTraffic() {
-        return mTrafficStamp &&
-            (mTrafficCount == (mTotalBytesWritten + mTotalBytesRead));
-    }
-
 private:
     // Value (set in mTCPKeepaliveConfig) indicates which set of prefs to use.
     enum TCPKeepaliveConfig {
       kTCPKeepaliveDisabled = 0,
       kTCPKeepaliveShortLivedConfig,
       kTCPKeepaliveLongLivedConfig
     };
 
@@ -301,20 +287,16 @@ private:
     bool                            mCompletedProxyConnect;
     bool                            mLastTransactionExpectedNoContent;
     bool                            mIdleMonitoring;
     bool                            mProxyConnectInProgress;
     bool                            mExperienced;
     bool                            mInSpdyTunnel;
     bool                            mForcePlainText;
 
-    // A snapshot of current number of transfered bytes
-    int64_t                         mTrafficCount;
-    bool                            mTrafficStamp; // true then the above is set
-
     // The number of <= HTTP/1.1 transactions performed on this connection. This
     // excludes spdy transactions.
     uint32_t                        mHttp1xTransactionCount;
 
     // Keep-Alive: max="mRemainingConnectionUses" provides the number of future
     // transactions (including the current one) that the server expects to allow
     // on this persistent connection.
     uint32_t                        mRemainingConnectionUses;
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -80,17 +80,16 @@ nsHttpConnectionMgr::nsHttpConnectionMgr
     , mMaxPersistConnsPerHost(0)
     , mMaxPersistConnsPerProxy(0)
     , mIsShuttingDown(false)
     , mNumActiveConns(0)
     , mNumIdleConns(0)
     , mNumSpdyActiveConns(0)
     , mNumHalfOpenConns(0)
     , mTimeOfNextWakeUp(UINT64_MAX)
-    , mPruningNoTraffic(false)
     , mTimeoutTickArmed(false)
     , mTimeoutTickNext(1)
 {
     LOG(("Creating nsHttpConnectionMgr @%p\n", this));
 }
 
 nsHttpConnectionMgr::~nsHttpConnectionMgr()
 {
@@ -267,18 +266,16 @@ nsHttpConnectionMgr::Observe(nsISupports
 
     if (0 == strcmp(topic, NS_TIMER_CALLBACK_TOPIC)) {
         nsCOMPtr<nsITimer> timer = do_QueryInterface(subject);
         if (timer == mTimer) {
             PruneDeadConnections();
         }
         else if (timer == mTimeoutTick) {
             TimeoutTick();
-        } else if (timer == mTrafficTimer) {
-            PruneNoTraffic();
         }
         else {
             MOZ_ASSERT(false, "unexpected timer-callback");
             LOG(("Unexpected timer object\n"));
             return NS_ERROR_UNEXPECTED;
         }
     }
 
@@ -326,35 +323,16 @@ nsHttpConnectionMgr::CancelTransaction(n
 }
 
 nsresult
 nsHttpConnectionMgr::PruneDeadConnections()
 {
     return PostEvent(&nsHttpConnectionMgr::OnMsgPruneDeadConnections);
 }
 
-//
-// Called after a timeout. Check for active connections that have had no
-// traffic since they were "marked" and nuke them.
-nsresult
-nsHttpConnectionMgr::PruneNoTraffic()
-{
-    LOG(("nsHttpConnectionMgr::PruneNoTraffic\n"));
-    mPruningNoTraffic = true;
-    return PostEvent(&nsHttpConnectionMgr::OnMsgPruneNoTraffic);
-}
-
-nsresult
-nsHttpConnectionMgr::VerifyTraffic()
-{
-    LOG(("nsHttpConnectionMgr::VerifyTraffic\n"));
-    return PostEvent(&nsHttpConnectionMgr::OnMsgVerifyTraffic);
-}
-
-
 nsresult
 nsHttpConnectionMgr::DoShiftReloadConnectionCleanup(nsHttpConnectionInfo *aCI)
 {
     nsRefPtr<nsHttpConnectionInfo> connInfo(aCI);
 
     nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup,
                             0, connInfo);
     if (NS_SUCCEEDED(rv))
@@ -1028,63 +1006,16 @@ nsHttpConnectionMgr::PruneDeadConnection
     ent->mIdleConns.Compact();
     ent->mActiveConns.Compact();
     ent->mPendingQ.Compact();
 
     return PL_DHASH_NEXT;
 }
 
 PLDHashOperator
-nsHttpConnectionMgr::VerifyTrafficCB(const nsACString &key,
-                                     nsAutoPtr<nsConnectionEntry> &ent,
-                                     void *closure)
-{
-    // Iterate over all active connections and check them
-    for (uint32_t index = 0; index < ent->mActiveConns.Length(); ++index) {
-        nsHttpConnection *conn = ent->mActiveConns[index];
-        conn->CheckForTraffic(true);
-    }
-    // Iterate the idle connections and unmark them for traffic checks
-    for (uint32_t index = 0; index < ent->mIdleConns.Length(); ++index) {
-        nsHttpConnection *conn = ent->mIdleConns[index];
-        conn->CheckForTraffic(false);
-    }
-
-    return PL_DHASH_NEXT;
-}
-
-PLDHashOperator
-nsHttpConnectionMgr::PruneNoTrafficCB(const nsACString &key,
-                                      nsAutoPtr<nsConnectionEntry> &ent,
-                                      void *closure)
-{
-    // Close the connections with no registered traffic
-    nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
-
-    LOG(("  pruning no traffic [ci=%s]\n", ent->mConnInfo->HashKey().get()));
-
-    uint32_t numConns = ent->mActiveConns.Length();
-    if (numConns) {
-        // walk the list backwards to allow us to remove entries easily
-        for (int index = numConns-1; index >= 0; index--) {
-            if (ent->mActiveConns[index]->NoTraffic()) {
-              nsRefPtr<nsHttpConnection> conn = dont_AddRef(ent->mActiveConns[index]);
-              ent->mActiveConns.RemoveElementAt(index);
-              self->DecrementActiveConnCount(conn);
-              conn->Close(NS_ERROR_ABORT);
-              LOG(("  closed active connection due to no traffic [conn=%p]\n",
-                   conn.get()));
-            }
-        }
-    }
-
-    return PL_DHASH_NEXT;
-}
-
-PLDHashOperator
 nsHttpConnectionMgr::ShutdownPassCB(const nsACString &key,
                                     nsAutoPtr<nsConnectionEntry> &ent,
                                     void *closure)
 {
     nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
 
     nsHttpTransaction *trans;
     nsHttpConnection *conn;
@@ -2278,20 +2209,16 @@ nsHttpConnectionMgr::OnMsgShutdown(int32
         mTimeoutTick->Cancel();
         mTimeoutTick = nullptr;
         mTimeoutTickArmed = false;
     }
     if (mTimer) {
       mTimer->Cancel();
       mTimer = nullptr;
     }
-    if (mTrafficTimer) {
-      mTrafficTimer->Cancel();
-      mTrafficTimer = nullptr;
-    }
 
     // signal shutdown complete
     nsRefPtr<nsIRunnable> runnable =
         new nsConnEvent(this, &nsHttpConnectionMgr::OnMsgShutdownConfirm,
                         0, param);
     NS_DispatchToMainThread(runnable);
 }
 
@@ -2471,60 +2398,16 @@ nsHttpConnectionMgr::OnMsgPruneDeadConne
 
     // check canreuse() for all idle connections plus any active connections on
     // connection entries that are using spdy.
     if (mNumIdleConns || (mNumActiveConns && gHttpHandler->IsSpdyEnabled()))
         mCT.Enumerate(PruneDeadConnectionsCB, this);
 }
 
 void
-nsHttpConnectionMgr::OnMsgPruneNoTraffic(int32_t, void *)
-{
-    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-    LOG(("nsHttpConnectionMgr::OnMsgPruneNoTraffic\n"));
-
-    // Prune connections without traffic
-    mCT.Enumerate(PruneNoTrafficCB, this);
-
-    mPruningNoTraffic = false; // not pruning anymore
-}
-
-void
-nsHttpConnectionMgr::OnMsgVerifyTraffic(int32_t, void *)
-{
-    MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
-    LOG(("nsHttpConnectionMgr::OnMsgVerifyTraffic\n"));
-
-    if (mPruningNoTraffic) {
-      // Called in the time gap when the timeout to prune notraffic
-      // connections has triggered but the pruning hasn't happened yet.
-      return;
-    }
-
-    // Mark connections for traffic verification
-    mCT.Enumerate(VerifyTrafficCB, this);
-
-    // If the timer is already there. we just re-init it
-    if(!mTrafficTimer) {
-        mTrafficTimer = do_CreateInstance("@mozilla.org/timer;1");
-    }
-
-    // failure to create a timer is not a fatal error, but dead
-    // connections will not be cleaned up as nicely
-    if (mTrafficTimer) {
-        // Give active connections time to get more traffic before killing
-        // them off. Default: 5000 milliseconds
-        mTrafficTimer->Init(this, gHttpHandler->NetworkChangedTimeout(),
-                            nsITimer::TYPE_ONE_SHOT);
-    } else {
-        NS_WARNING("failed to create timer for VerifyTraffic!");
-    }
-}
-
-void
 nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup(int32_t, void *param)
 {
     LOG(("nsHttpConnectionMgr::OnMsgDoShiftReloadConnectionCleanup\n"));
     MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread);
 
     nsRefPtr<nsHttpConnectionInfo> ci =
         dont_AddRef(static_cast<nsHttpConnectionInfo *>(param));
 
--- a/netwerk/protocol/http/nsHttpConnectionMgr.h
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.h
@@ -85,24 +85,16 @@ public:
     // cancels a transaction w/ the given reason.
     nsresult CancelTransaction(nsHttpTransaction *, nsresult reason);
     nsresult CancelTransactions(nsHttpConnectionInfo *, nsresult reason);
 
     // called to force the connection manager to prune its list of idle
     // connections.
     nsresult PruneDeadConnections();
 
-    // called to close active connections with no registered "traffic"
-    nsresult PruneNoTraffic();
-
-    // "VerifyTraffic" means marking connections now, and then check again in
-    // N seconds to see if there's been any traffic and if not, kill
-    // that connection.
-    nsresult VerifyTraffic();
-
     // Close all idle persistent connections and prevent any active connections
     // from being reused. Optional connection info resets CI specific
     // information such as Happy Eyeballs history.
     nsresult DoShiftReloadConnectionCleanup(nsHttpConnectionInfo *);
 
     // called to get a reference to the socket transport service.  the socket
     // transport service is not available when the connection manager is down.
     nsresult GetSocketThreadTarget(nsIEventTarget **);
@@ -246,19 +238,16 @@ public:
     bool     SupportsPipelining(nsHttpConnectionInfo *);
 
     bool GetConnectionData(nsTArray<HttpRetParams> *);
 
     void ResetIPFamilyPreference(nsHttpConnectionInfo *);
 
     uint16_t MaxRequestDelay() { return mMaxRequestDelay; }
 
-    // public, so that the SPDY/http2 seesions can activate
-    void ActivateTimeoutTick();
-
 private:
     virtual ~nsHttpConnectionMgr();
 
     enum PipeliningState {
         // Host has proven itself pipeline capable through past experience and
         // large pipeline depths are allowed on multiple connections.
         PS_GREEN,
 
@@ -531,18 +520,16 @@ private:
     static PLDHashOperator ProcessOneTransactionCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
     static PLDHashOperator ProcessAllTransactionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
 
     static PLDHashOperator PruneDeadConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
     static PLDHashOperator ShutdownPassCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
     static PLDHashOperator PurgeExcessIdleConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
     static PLDHashOperator PurgeExcessSpdyConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
     static PLDHashOperator ClosePersistentConnectionsCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
-    static PLDHashOperator VerifyTrafficCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
-    static PLDHashOperator PruneNoTrafficCB(const nsACString &, nsAutoPtr<nsConnectionEntry> &, void *);
     bool     ProcessPendingQForEntry(nsConnectionEntry *, bool considerAll);
     bool     IsUnderPressure(nsConnectionEntry *ent,
                              nsHttpTransaction::Classifier classification);
     bool     AtActiveConnectionLimit(nsConnectionEntry *, uint32_t caps);
     nsresult TryDispatchTransaction(nsConnectionEntry *ent,
                                     bool onlyReusedConnection,
                                     nsHttpTransaction *trans);
     nsresult DispatchTransaction(nsConnectionEntry *,
@@ -651,18 +638,16 @@ private:
     void OnMsgSpeculativeConnect   (int32_t, void *);
     void OnMsgReclaimConnection    (int32_t, void *);
     void OnMsgCompleteUpgrade      (int32_t, void *);
     void OnMsgUpdateParam          (int32_t, void *);
     void OnMsgDoShiftReloadConnectionCleanup (int32_t, void *);
     void OnMsgProcessFeedback      (int32_t, void *);
     void OnMsgProcessAllSpdyPendingQ (int32_t, void *);
     void OnMsgUpdateRequestTokenBucket (int32_t, void *);
-    void OnMsgVerifyTraffic (int32_t, void *);
-    void OnMsgPruneNoTraffic (int32_t, void *);
 
     // Total number of active connections in all of the ConnectionEntry objects
     // that are accessed from mCT connection table.
     uint16_t mNumActiveConns;
     // Total number of idle connections in all of the ConnectionEntry objects
     // that are accessed from mCT connection table.
     uint16_t mNumIdleConns;
     // Total number of spdy connections which are a subset of the active conns
@@ -670,19 +655,16 @@ private:
     // Total number of connections in mHalfOpens ConnectionEntry objects
     // that are accessed from mCT connection table
     uint32_t mNumHalfOpenConns;
 
     // Holds time in seconds for next wake-up to prune dead connections.
     uint64_t mTimeOfNextWakeUp;
     // Timer for next pruning of dead connections.
     nsCOMPtr<nsITimer> mTimer;
-    // Timer for pruning stalled connections after changed network.
-    nsCOMPtr<nsITimer> mTrafficTimer;
-    bool mPruningNoTraffic;
 
     // A 1s tick to call nsHttpConnection::ReadTimeoutTick on
     // active http/1 connections and check for orphaned half opens.
     // Disabled when there are no active or half open connections.
     nsCOMPtr<nsITimer> mTimeoutTick;
     bool mTimeoutTickArmed;
     uint32_t mTimeoutTickNext;
 
@@ -698,16 +680,17 @@ private:
     static PLDHashOperator ReadConnectionEntry(const nsACString &key,
                                                nsAutoPtr<nsConnectionEntry> &ent,
                                                void *aArg);
     static PLDHashOperator RemoveDeadConnections(const nsACString &key,
         nsAutoPtr<nsConnectionEntry> &ent,
         void *aArg);
 
     // Read Timeout Tick handlers
+    void ActivateTimeoutTick();
     void TimeoutTick();
     static PLDHashOperator TimeoutTickCB(const nsACString &key,
                                          nsAutoPtr<nsConnectionEntry> &ent,
                                          void *closure);
 
     // For diagnostics
     void OnMsgPrintDiagnostics(int32_t, void *);
     static PLDHashOperator PrintDiagnosticsCB(const nsACString &key,
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -42,17 +42,16 @@
 #include "nsIObserverService.h"
 #include "nsISiteSecurityService.h"
 #include "nsIStreamConverterService.h"
 #include "nsITimer.h"
 #include "nsCRT.h"
 #include "SpdyZlibReporter.h"
 #include "nsIMemoryReporter.h"
 #include "nsIParentalControlsService.h"
-#include "nsINetworkLinkService.h"
 
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/Telemetry.h"
 
 #if defined(XP_UNIX)
 #include <sys/utsname.h>
 #endif
 
@@ -139,17 +138,16 @@ nsHttpHandler::nsHttpHandler()
     , mReferrerTrimmingPolicy(0)
     , mReferrerXOriginPolicy(0)
     , mFastFallbackToIPv4(false)
     , mProxyPipelining(true)
     , mIdleTimeout(PR_SecondsToInterval(10))
     , mSpdyTimeout(PR_SecondsToInterval(180))
     , mResponseTimeout(PR_SecondsToInterval(300))
     , mResponseTimeoutEnabled(false)
-    , mNetworkChangedTimeout(5000)
     , mMaxRequestAttempts(10)
     , mMaxRequestDelay(10)
     , mIdleSynTimeout(250)
     , mPipeliningEnabled(false)
     , mMaxConnections(24)
     , mMaxPersistentConnectionsPerServer(2)
     , mMaxPersistentConnectionsPerProxy(4)
     , mMaxPipelinedRequests(32)
@@ -344,17 +342,16 @@ nsHttpHandler::Init()
         mObserverService->AddObserver(this, "profile-change-net-teardown", true);
         mObserverService->AddObserver(this, "profile-change-net-restore", true);
         mObserverService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
         mObserverService->AddObserver(this, "net:clear-active-logins", true);
         mObserverService->AddObserver(this, "net:prune-dead-connections", true);
         mObserverService->AddObserver(this, "net:failed-to-process-uri-content", true);
         mObserverService->AddObserver(this, "last-pb-context-exited", true);
         mObserverService->AddObserver(this, "browser:purge-session-history", true);
-        mObserverService->AddObserver(this, NS_NETWORK_LINK_TOPIC, false);
     }
 
     MakeNewRequestTokenBucket();
     mWifiTickler = new Tickler();
     if (NS_FAILED(mWifiTickler->Init()))
         mWifiTickler = nullptr;
 
     nsCOMPtr<nsIParentalControlsService> pc = do_CreateInstance("@mozilla.org/parental-controls-service;1");
@@ -855,22 +852,16 @@ nsHttpHandler::PrefsChanged(nsIPrefBranc
     }
 
     if (PREF_CHANGED(HTTP_PREF("response.timeout"))) {
         rv = prefs->GetIntPref(HTTP_PREF("response.timeout"), &val);
         if (NS_SUCCEEDED(rv))
             mResponseTimeout = PR_SecondsToInterval(clamped(val, 0, 0xffff));
     }
 
-    if (PREF_CHANGED(HTTP_PREF("network-changed.timeout"))) {
-        rv = prefs->GetIntPref(HTTP_PREF("network-changed.timeout"), &val);
-        if (NS_SUCCEEDED(rv))
-            mNetworkChangedTimeout = clamped(val, 1, 600) * 1000;
-    }
-
     if (PREF_CHANGED(HTTP_PREF("max-connections"))) {
         rv = prefs->GetIntPref(HTTP_PREF("max-connections"), &val);
         if (NS_SUCCEEDED(rv)) {
 
             mMaxConnections = (uint16_t) clamped((uint32_t)val,
                                                  (uint32_t)1, MaxSocketCount());
 
             if (mConnMgr)
@@ -1781,18 +1772,19 @@ nsHttpHandler::Observe(nsISupports *subj
                        const char16_t *data)
 {
     LOG(("nsHttpHandler::Observe [topic=\"%s\"]\n", topic));
 
     if (strcmp(topic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0) {
         nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(subject);
         if (prefBranch)
             PrefsChanged(prefBranch, NS_ConvertUTF16toUTF8(data).get());
-    } else if (strcmp(topic, "profile-change-net-teardown")    == 0 ||
-               strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)    == 0) {
+    }
+    else if (strcmp(topic, "profile-change-net-teardown")    == 0 ||
+             strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)    == 0) {
 
         mHandlerActive = false;
 
         // clear cache of all authentication credentials.
         mAuthCache.ClearAll();
         mPrivateAuthCache.ClearAll();
         if (mWifiTickler)
             mWifiTickler->Cancel();
@@ -1802,51 +1794,47 @@ nsHttpHandler::Observe(nsISupports *subj
             mConnMgr->Shutdown();
 
         // need to reset the session start time since cache validation may
         // depend on this value.
         mSessionStartTime = NowInSeconds();
 
         if (!mDoNotTrackEnabled) {
             Telemetry::Accumulate(Telemetry::DNT_USAGE, DONOTTRACK_VALUE_UNSET);
-        } else {
+        }
+        else {
             Telemetry::Accumulate(Telemetry::DNT_USAGE, mDoNotTrackValue);
         }
-    } else if (strcmp(topic, "profile-change-net-restore") == 0) {
+    }
+    else if (strcmp(topic, "profile-change-net-restore") == 0) {
         // initialize connection manager
         InitConnectionMgr();
-    } else if (strcmp(topic, "net:clear-active-logins") == 0) {
+    }
+    else if (strcmp(topic, "net:clear-active-logins") == 0) {
         mAuthCache.ClearAll();
         mPrivateAuthCache.ClearAll();
-    } else if (strcmp(topic, "net:prune-dead-connections") == 0) {
+    }
+    else if (strcmp(topic, "net:prune-dead-connections") == 0) {
         if (mConnMgr) {
             mConnMgr->PruneDeadConnections();
         }
-    } else if (strcmp(topic, "net:failed-to-process-uri-content") == 0) {
+    }
+    else if (strcmp(topic, "net:failed-to-process-uri-content") == 0) {
         nsCOMPtr<nsIURI> uri = do_QueryInterface(subject);
-        if (uri && mConnMgr) {
+        if (uri && mConnMgr)
             mConnMgr->ReportFailedToProcess(uri);
-        }
-    } else if (strcmp(topic, "last-pb-context-exited") == 0) {
+    }
+    else if (strcmp(topic, "last-pb-context-exited") == 0) {
         mPrivateAuthCache.ClearAll();
     } else if (strcmp(topic, "browser:purge-session-history") == 0) {
         if (mConnMgr && gSocketTransportService) {
             nsCOMPtr<nsIRunnable> event = NS_NewRunnableMethod(mConnMgr,
                 &nsHttpConnectionMgr::ClearConnectionHistory);
             gSocketTransportService->Dispatch(event, NS_DISPATCH_NORMAL);
         }
-    } else if (strcmp(topic, NS_NETWORK_LINK_TOPIC) == 0) {
-        nsCString converted = NS_ConvertUTF16toUTF8(data);
-        const char *state = converted.get();
-        if (strcmp(state, NS_NETWORK_LINK_DATA_CHANGED) == 0) {
-            if (mConnMgr) {
-                mConnMgr->PruneDeadConnections();
-                mConnMgr->VerifyTraffic();
-            }
-        }
     }
 
     return NS_OK;
 }
 
 // nsISpeculativeConnect
 
 NS_IMETHODIMP
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -74,17 +74,16 @@ public:
     bool           SendSecureXSiteReferrer() { return mSendSecureXSiteReferrer; }
     uint8_t        RedirectionLimit()        { return mRedirectionLimit; }
     PRIntervalTime IdleTimeout()             { return mIdleTimeout; }
     PRIntervalTime SpdyTimeout()             { return mSpdyTimeout; }
     PRIntervalTime ResponseTimeout() {
       return mResponseTimeoutEnabled ? mResponseTimeout : 0;
     }
     PRIntervalTime ResponseTimeoutEnabled()  { return mResponseTimeoutEnabled; }
-    uint32_t       NetworkChangedTimeout()   { return mNetworkChangedTimeout; }
     uint16_t       MaxRequestAttempts()      { return mMaxRequestAttempts; }
     const char    *DefaultSocketType()       { return mDefaultSocketType.get(); /* ok to return null */ }
     uint32_t       PhishyUserPassLength()    { return mPhishyUserPassLength; }
     uint8_t        GetQoSBits()              { return mQoSBits; }
     uint16_t       GetIdleSynTimeout()       { return mIdleSynTimeout; }
     bool           FastFallbackToIPv4()      { return mFastFallbackToIPv4; }
     bool           ProxyPipelining()         { return mProxyPipelining; }
     uint32_t       MaxSocketCount();
@@ -353,17 +352,17 @@ private:
     uint8_t  mReferrerXOriginPolicy;
 
     bool mFastFallbackToIPv4;
     bool mProxyPipelining;
     PRIntervalTime mIdleTimeout;
     PRIntervalTime mSpdyTimeout;
     PRIntervalTime mResponseTimeout;
     bool mResponseTimeoutEnabled;
-    uint32_t mNetworkChangedTimeout; // milliseconds
+
     uint16_t mMaxRequestAttempts;
     uint16_t mMaxRequestDelay;
     uint16_t mIdleSynTimeout;
 
     bool     mPipeliningEnabled;
     uint16_t mMaxConnections;
     uint8_t  mMaxPersistentConnectionsPerServer;
     uint8_t  mMaxPersistentConnectionsPerProxy;
--- a/netwerk/protocol/websocket/BaseWebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/BaseWebSocketChannel.cpp
@@ -19,17 +19,16 @@ PRLogModuleInfo *webSocketLog = nullptr;
 namespace mozilla {
 namespace net {
 
 BaseWebSocketChannel::BaseWebSocketChannel()
   : mEncrypted(0)
   , mWasOpened(0)
   , mClientSetPingInterval(0)
   , mClientSetPingTimeout(0)
-  , mPingForced(0)
   , mPingInterval(0)
   , mPingResponseTimeout(10000)
 {
 #if defined(PR_LOGGING)
   if (!webSocketLog)
     webSocketLog = PR_NewLogModule("nsWebSocket");
 #endif
 }
--- a/netwerk/protocol/websocket/BaseWebSocketChannel.h
+++ b/netwerk/protocol/websocket/BaseWebSocketChannel.h
@@ -64,17 +64,16 @@ class BaseWebSocketChannel : public nsIW
   nsCString                       mOrigin;
 
   nsCString                       mNegotiatedExtensions;
 
   uint32_t                        mEncrypted                 : 1;
   uint32_t                        mWasOpened                 : 1;
   uint32_t                        mClientSetPingInterval     : 1;
   uint32_t                        mClientSetPingTimeout      : 1;
-  uint32_t                        mPingForced                : 1;
 
   uint32_t                        mPingInterval;         /* milliseconds */
   uint32_t                        mPingResponseTimeout;  /* milliseconds */
 };
 
 } // namespace net
 } // namespace mozilla
 
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -30,18 +30,16 @@
 #include "nsIDashboardEventNotifier.h"
 #include "nsIEventTarget.h"
 #include "nsIHttpChannel.h"
 #include "nsILoadGroup.h"
 #include "nsIProtocolHandler.h"
 #include "nsIRandomGenerator.h"
 #include "nsISocketTransport.h"
 #include "nsThreadUtils.h"
-#include "nsINetworkLinkService.h"
-#include "nsIObserverService.h"
 
 #include "nsAutoPtr.h"
 #include "nsNetCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsCRT.h"
 #include "nsThreadUtils.h"
 #include "nsError.h"
 #include "nsStringStream.h"
@@ -82,18 +80,17 @@ NS_IMPL_ISUPPORTS(WebSocketChannel,
                   nsIProtocolHandler,
                   nsIInputStreamCallback,
                   nsIOutputStreamCallback,
                   nsITimerCallback,
                   nsIDNSListener,
                   nsIProtocolProxyCallback,
                   nsIInterfaceRequestor,
                   nsIChannelEventSink,
-                  nsIThreadRetargetableRequest,
-                  nsIObserver)
+                  nsIThreadRetargetableRequest)
 
 // We implement RFC 6455, which uses Sec-WebSocket-Version: 13 on the wire.
 #define SEC_WEBSOCKET_VERSION "13"
 
 /*
  * About SSL unsigned certificates
  *
  * wss will not work to a host using an unsigned certificate unless there
@@ -1044,26 +1041,16 @@ WebSocketChannel::WebSocketChannel() :
   mFramePtr = mBuffer = static_cast<uint8_t *>(moz_xmalloc(mBufferSize));
 
   nsresult rv;
   mConnectionLogService = do_GetService("@mozilla.org/network/dashboard;1",&rv);
   if (NS_FAILED(rv))
     LOG(("Failed to initiate dashboard service."));
 
   mSerial = sSerialSeed++;
-
-  // Register for prefs change notifications
-  nsCOMPtr<nsIObserverService> observerService =
-    mozilla::services::GetObserverService();
-  if (observerService) {
-    observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, false);
-  } else {
-    NS_WARNING("failed to get observer service");
-  }
-
 }
 
 WebSocketChannel::~WebSocketChannel()
 {
   LOG(("WebSocketChannel::~WebSocketChannel() %p\n", this));
 
   if (mWasOpened) {
     MOZ_ASSERT(mCalledOnStop, "WebSocket was opened but OnStop was not called");
@@ -1112,65 +1099,16 @@ WebSocketChannel::~WebSocketChannel()
 
   if (mLoadGroup) {
     nsILoadGroup *forgettableGroup;
     mLoadGroup.forget(&forgettableGroup);
     NS_ProxyRelease(mainThread, forgettableGroup, false);
   }
 }
 
-NS_IMETHODIMP
-WebSocketChannel::Observe(nsISupports *subject,
-                          const char *topic,
-                          const char16_t *data)
-{
-  LOG(("WebSocketChannel::Observe [topic=\"%s\"]\n", topic));
-
-  if (strcmp(topic, NS_NETWORK_LINK_TOPIC) == 0) {
-    nsCString converted = NS_ConvertUTF16toUTF8(data);
-    const char *state = converted.get();
-
-    if (strcmp(state, NS_NETWORK_LINK_DATA_CHANGED) == 0) {
-      LOG(("WebSocket: received network CHANGED event"));
-      if (mPingOutstanding) {
-        // If there's an outstanding ping that's expected to get a pong back
-        // we let that do its thing.
-        LOG(("WebSocket: pong already pending"));
-      } else if (!mSocketThread) {
-        // there has not been an asyncopen yet on the object and then we need
-        // no ping.
-        LOG(("WebSocket: early object, no ping needed"));
-      } else {
-        LOG(("nsWebSocketChannel:: Generating Ping as network changed\n"));
-
-        if (mPingForced) {
-          // avoid more than one
-          return NS_OK;
-        }
-        if (!mPingTimer) {
-          // The ping timer is only conditionally running already. If it
-          // wasn't already created do it here.
-          nsresult rv;
-          mPingTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
-          if (NS_FAILED(rv)) {
-            NS_WARNING("unable to create ping timer. Carrying on.");
-          } else {
-            mPingTimer->SetTarget(mSocketThread);
-          }
-        }
-        // Trigger the ping timeout asap to fire off a new ping. Wait just
-        // a little bit to better avoid multi-triggers.
-        mPingForced = 1;
-        mPingTimer->InitWithCallback(this, 200, nsITimer::TYPE_ONE_SHOT);
-      }
-    }
-  }
-  return NS_OK;
-}
-
 void
 WebSocketChannel::Shutdown()
 {
   nsWSAdmissionManager::Shutdown();
 }
 
 void
 WebSocketChannel::BeginOpen()
@@ -2680,26 +2618,21 @@ WebSocketChannel::Notify(nsITimer *timer
 
     if (mClientClosed || mServerClosed || mRequestedClose) {
       // no point in worrying about ping now
       mPingTimer = nullptr;
       return NS_OK;
     }
 
     if (!mPingOutstanding) {
-      // Allow for the case where a PING was force-sent even though ping
-      // interval isn't enabled. Only issue a new PING if it truly is enabled.
-      if (mPingInterval || mPingForced) {
-        LOG(("nsWebSocketChannel:: Generating Ping\n"));
-        mPingOutstanding = 1;
-        mPingForced = 0;
-        GeneratePing();
-        mPingTimer->InitWithCallback(this, mPingResponseTimeout,
-                                     nsITimer::TYPE_ONE_SHOT);
-      }
+      LOG(("nsWebSocketChannel:: Generating Ping\n"));
+      mPingOutstanding = 1;
+      GeneratePing();
+      mPingTimer->InitWithCallback(this, mPingResponseTimeout,
+                                   nsITimer::TYPE_ONE_SHOT);
     } else {
       LOG(("nsWebSocketChannel:: Timed out Ping\n"));
       mPingTimer = nullptr;
       AbortSession(NS_ERROR_NET_TIMEOUT);
     }
   } else if (timer == mLingeringCloseTimer) {
     LOG(("WebSocketChannel:: Lingering Close Timer"));
     CleanupConnection();
--- a/netwerk/protocol/websocket/WebSocketChannel.h
+++ b/netwerk/protocol/websocket/WebSocketChannel.h
@@ -9,17 +9,16 @@
 
 #include "nsISupports.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIStreamListener.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIAsyncOutputStream.h"
 #include "nsITimer.h"
 #include "nsIDNSListener.h"
-#include "nsIObserver.h"
 #include "nsIProtocolProxyCallback.h"
 #include "nsIChannelEventSink.h"
 #include "nsIHttpChannelInternal.h"
 #include "BaseWebSocketChannel.h"
 
 #ifdef MOZ_WIDGET_GONK
 #include "nsINetworkManager.h"
 #include "nsProxyRelease.h"
@@ -58,34 +57,32 @@ enum wsConnectingState {
 
 class WebSocketChannel : public BaseWebSocketChannel,
                          public nsIHttpUpgradeListener,
                          public nsIStreamListener,
                          public nsIInputStreamCallback,
                          public nsIOutputStreamCallback,
                          public nsITimerCallback,
                          public nsIDNSListener,
-                         public nsIObserver,
                          public nsIProtocolProxyCallback,
                          public nsIInterfaceRequestor,
                          public nsIChannelEventSink
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIHTTPUPGRADELISTENER
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_NSIINPUTSTREAMCALLBACK
   NS_DECL_NSIOUTPUTSTREAMCALLBACK
   NS_DECL_NSITIMERCALLBACK
   NS_DECL_NSIDNSLISTENER
   NS_DECL_NSIPROTOCOLPROXYCALLBACK
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSICHANNELEVENTSINK
-  NS_DECL_NSIOBSERVER
 
   // nsIWebSocketChannel methods BaseWebSocketChannel didn't implement for us
   //
   NS_IMETHOD AsyncOpen(nsIURI *aURI,
                        const nsACString &aOrigin,
                        nsIWebSocketListener *aListener,
                        nsISupports *aContext);
   NS_IMETHOD Close(uint16_t aCode, const nsACString & aReason);
@@ -158,18 +155,18 @@ private:
   bool     IsPersistentFramePtr();
   nsresult ProcessInput(uint8_t *buffer, uint32_t count);
   bool UpdateReadBuffer(uint8_t *buffer, uint32_t count,
                         uint32_t accumulatedFragments,
                         uint32_t *available);
 
   inline void ResetPingTimer()
   {
-    mPingOutstanding = 0;
     if (mPingTimer) {
+      mPingOutstanding = 0;
       mPingTimer->SetDelay(mPingInterval);
     }
   }
 
   nsCOMPtr<nsIEventTarget>                 mSocketThread;
   nsCOMPtr<nsIHttpChannelInternal>         mChannel;
   nsCOMPtr<nsIHttpChannel>                 mHttpChannel;
   nsCOMPtr<nsICancelable>                  mCancelable;
--- a/netwerk/system/win32/nsNotifyAddrListener.cpp
+++ b/netwerk/system/win32/nsNotifyAddrListener.cpp
@@ -7,63 +7,33 @@
 #include <stdarg.h>
 #include <windef.h>
 #include <winbase.h>
 #include <wingdi.h>
 #include <winuser.h>
 #include <ole2.h>
 #include <netcon.h>
 #include <objbase.h>
-#include <winsock2.h>
-#include <ws2ipdef.h>
-#include <tcpmib.h>
-#include <iphlpapi.h>
-#include <netioapi.h>
 #include <iprtrmib.h>
 #include "plstr.h"
 #include "nsThreadUtils.h"
 #include "nsIObserverService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsNotifyAddrListener.h"
 #include "nsString.h"
 #include "nsAutoPtr.h"
 #include "mozilla/Services.h"
 #include "nsCRT.h"
-#include "mozilla/Preferences.h"
 
 #include <iptypes.h>
 #include <iphlpapi.h>
 
-using namespace mozilla;
-
 static HMODULE sNetshell;
 static decltype(NcFreeNetconProperties)* sNcFreeNetconProperties;
 
-static HMODULE sIphlpapi;
-static decltype(NotifyIpInterfaceChange)* sNotifyIpInterfaceChange;
-static decltype(CancelMibChangeNotify2)* sCancelMibChangeNotify2;
-
-#define NETWORK_NOTIFY_CHANGED_PREF "network.notify.changed"
-
-static void InitIphlpapi(void)
-{
-    if (!sIphlpapi) {
-        sIphlpapi = LoadLibraryW(L"Iphlpapi.dll");
-        if (sIphlpapi) {
-            sNotifyIpInterfaceChange = (decltype(NotifyIpInterfaceChange)*)
-                GetProcAddress(sIphlpapi, "NotifyIpInterfaceChange");
-            sCancelMibChangeNotify2 = (decltype(CancelMibChangeNotify2)*)
-                GetProcAddress(sIphlpapi, "CancelMibChangeNotify2");
-        } else {
-            NS_WARNING("Failed to load Iphlpapi.dll - cannot detect network"
-                       " changes!");
-        }
-    }
-}
-
 static void InitNetshellLibrary(void)
 {
     if (!sNetshell) {
         sNetshell = LoadLibraryW(L"Netshell.dll");
         if (sNetshell) {
             sNcFreeNetconProperties = (decltype(NcFreeNetconProperties)*)
                 GetProcAddress(sNetshell, "NcFreeNetconProperties");
         }
@@ -72,37 +42,29 @@ static void InitNetshellLibrary(void)
 
 static void FreeDynamicLibraries(void)
 {
     if (sNetshell) {
         sNcFreeNetconProperties = nullptr;
         FreeLibrary(sNetshell);
         sNetshell = nullptr;
     }
-    if (sIphlpapi) {
-        sNotifyIpInterfaceChange = nullptr;
-        sCancelMibChangeNotify2 = nullptr;
-        FreeLibrary(sIphlpapi);
-        sIphlpapi = nullptr;
-    }
 }
 
 NS_IMPL_ISUPPORTS(nsNotifyAddrListener,
                   nsINetworkLinkService,
                   nsIRunnable,
                   nsIObserver)
 
 nsNotifyAddrListener::nsNotifyAddrListener()
     : mLinkUp(true)  // assume true by default
     , mStatusKnown(false)
     , mCheckAttempted(false)
     , mShutdownEvent(nullptr)
-    , mAllowChangedEvent(true)
 {
-    InitIphlpapi();
 }
 
 nsNotifyAddrListener::~nsNotifyAddrListener()
 {
     NS_ASSERTION(!mThread, "nsNotifyAddrListener thread shutdown failed");
     FreeDynamicLibraries();
 }
 
@@ -130,72 +92,46 @@ nsNotifyAddrListener::GetLinkType(uint32
 {
   NS_ENSURE_ARG_POINTER(aLinkType);
 
   // XXX This function has not yet been implemented for this platform
   *aLinkType = nsINetworkLinkService::LINK_TYPE_UNKNOWN;
   return NS_OK;
 }
 
-// Static Callback function for NotifyIpInterfaceChange API.
-static void WINAPI OnInterfaceChange(PVOID callerContext,
-                                     PMIB_IPINTERFACE_ROW row,
-                                     MIB_NOTIFICATION_TYPE notificationType)
-{
-    nsNotifyAddrListener *notify = static_cast<nsNotifyAddrListener*>(callerContext);
-    notify->CheckLinkStatus();
-}
-
 NS_IMETHODIMP
 nsNotifyAddrListener::Run()
 {
     PR_SetCurrentThreadName("Link Monitor");
-    if (!sNotifyIpInterfaceChange || !sCancelMibChangeNotify2) {
-        // For Windows versions which are older than Vista which lack
-        // NotifyIpInterfaceChange. Note this means no IPv6 support.
-        HANDLE ev = CreateEvent(nullptr, FALSE, FALSE, nullptr);
-        NS_ENSURE_TRUE(ev, NS_ERROR_OUT_OF_MEMORY);
+
+    HANDLE ev = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+    NS_ENSURE_TRUE(ev, NS_ERROR_OUT_OF_MEMORY);
 
-        HANDLE handles[2] = { ev, mShutdownEvent };
-        OVERLAPPED overlapped = { 0 };
-        bool shuttingDown = false;
+    HANDLE handles[2] = { ev, mShutdownEvent };
+    OVERLAPPED overlapped = { 0 };
+    bool shuttingDown = false;
 
-        overlapped.hEvent = ev;
-        while (!shuttingDown) {
-            HANDLE h;
-            DWORD ret = NotifyAddrChange(&h, &overlapped);
+    overlapped.hEvent = ev;
+    while (!shuttingDown) {
+        HANDLE h;
+        DWORD ret = NotifyAddrChange(&h, &overlapped);
 
-            if (ret == ERROR_IO_PENDING) {
-                ret = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
-                if (ret == WAIT_OBJECT_0) {
-                    CheckLinkStatus();
-                } else {
-                    shuttingDown = true;
-                }
+        if (ret == ERROR_IO_PENDING) {
+            ret = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
+            if (ret == WAIT_OBJECT_0) {
+                CheckLinkStatus();
             } else {
                 shuttingDown = true;
             }
+        } else {
+            shuttingDown = true;
         }
-        CloseHandle(ev);
-    } else {
-        // Windows Vista and newer versions.
-        HANDLE interfacechange;
-        // The callback will simply invoke CheckLinkStatus()
-        DWORD ret = sNotifyIpInterfaceChange(
-            AF_UNSPEC, // IPv4 and IPv6
-            (PIPINTERFACE_CHANGE_CALLBACK)OnInterfaceChange,
-            this,  // pass to callback
-            false, // no initial notification
-            &interfacechange);
+    }
+    CloseHandle(ev);
 
-        if (ret == NO_ERROR) {
-            ret = WaitForSingleObject(mShutdownEvent, INFINITE);
-        }
-        sCancelMibChangeNotify2(interfacechange);
-    }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNotifyAddrListener::Observe(nsISupports *subject,
                               const char *topic,
                               const char16_t *data)
 {
@@ -212,19 +148,16 @@ nsNotifyAddrListener::Init(void)
         mozilla::services::GetObserverService();
     if (!observerService)
         return NS_ERROR_FAILURE;
 
     nsresult rv = observerService->AddObserver(this, "xpcom-shutdown-threads",
                                                false);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    Preferences::AddBoolVarCache(&mAllowChangedEvent,
-                                 NETWORK_NOTIFY_CHANGED_PREF, true);
-
     mShutdownEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
     NS_ENSURE_TRUE(mShutdownEvent, NS_ERROR_OUT_OF_MEMORY);
 
     rv = NS_NewThread(getter_AddRefs(mThread), this);
     NS_ENSURE_SUCCESS(rv, rv);
 
     return NS_OK;
 }
@@ -251,21 +184,21 @@ nsNotifyAddrListener::Shutdown(void)
     mThread = nullptr;
 
     CloseHandle(mShutdownEvent);
     mShutdownEvent = nullptr;
 
     return rv;
 }
 
-/* Sends the given event.  Assumes aEventID never goes out of scope (static
- * strings are ideal).
+/* Sends the given event to the UI thread.  Assumes aEventID never goes out
+ * of scope (static strings are ideal).
  */
 nsresult
-nsNotifyAddrListener::SendEvent(const char *aEventID)
+nsNotifyAddrListener::SendEventToUI(const char *aEventID)
 {
     if (!aEventID)
         return NS_ERROR_NULL_POINTER;
 
     nsresult rv;
     nsCOMPtr<nsIRunnable> event = new ChangeEvent(this, aEventID);
     if (NS_FAILED(rv = NS_DispatchToMainThread(event)))
         NS_WARNING("Failed to dispatch ChangeEvent");
@@ -279,22 +212,18 @@ nsNotifyAddrListener::ChangeEvent::Run()
         mozilla::services::GetObserverService();
     if (observerService)
         observerService->NotifyObservers(
                 mService, NS_NETWORK_LINK_TOPIC,
                 NS_ConvertASCIItoUTF16(mEventID).get());
     return NS_OK;
 }
 
-
-// Bug 465158 features an explanation for this check. ICS being "Internet
-// Connection Sharing). The description says it is always IP address
-// 192.168.0.1 for this case.
 bool
-nsNotifyAddrListener::CheckICSGateway(PIP_ADAPTER_ADDRESSES aAdapter)
+nsNotifyAddrListener::CheckIsGateway(PIP_ADAPTER_ADDRESSES aAdapter)
 {
     if (!aAdapter->FirstUnicastAddress)
         return false;
 
     LPSOCKADDR aAddress = aAdapter->FirstUnicastAddress->Address.lpSockaddr;
     if (!aAddress)
         return false;
 
@@ -386,132 +315,77 @@ nsNotifyAddrListener::CheckICSStatus(PWC
     return isICSGatewayAdapter;
 }
 
 DWORD
 nsNotifyAddrListener::CheckAdaptersAddresses(void)
 {
     ULONG len = 16384;
 
-    PIP_ADAPTER_ADDRESSES adapterList = (PIP_ADAPTER_ADDRESSES) moz_xmalloc(len);
-
-    ULONG flags = GAA_FLAG_SKIP_DNS_SERVER|GAA_FLAG_SKIP_MULTICAST|
-        GAA_FLAG_SKIP_ANYCAST;
+    PIP_ADAPTER_ADDRESSES addresses = (PIP_ADAPTER_ADDRESSES) malloc(len);
+    if (!addresses)
+        return ERROR_OUTOFMEMORY;
 
-    DWORD ret = GetAdaptersAddresses(AF_UNSPEC, flags, nullptr, adapterList, &len);
+    DWORD ret = GetAdaptersAddresses(AF_UNSPEC, 0, nullptr, addresses, &len);
     if (ret == ERROR_BUFFER_OVERFLOW) {
-        free(adapterList);
-        adapterList = static_cast<PIP_ADAPTER_ADDRESSES> (moz_xmalloc(len));
-
-        ret = GetAdaptersAddresses(AF_UNSPEC, flags, nullptr, adapterList, &len);
+        free(addresses);
+        addresses = (PIP_ADAPTER_ADDRESSES) malloc(len);
+        if (!addresses)
+            return ERROR_BUFFER_OVERFLOW;
+        ret = GetAdaptersAddresses(AF_UNSPEC, 0, nullptr, addresses, &len);
     }
 
     if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED))) {
-        free(adapterList);
+        free(addresses);
         return ERROR_NOT_SUPPORTED;
     }
 
-    //
-    // Since NotifyIpInterfaceChange() signals a change more often than we
-    // think is a worthy change, we checksum the entire state of all interfaces
-    // that are UP. If the checksum is the same as previous check, nothing
-    // of interest changed!
-    //
-    ULONG sum = 0;
-
     if (ret == ERROR_SUCCESS) {
+        PIP_ADAPTER_ADDRESSES ptr;
         bool linkUp = false;
 
-        for (PIP_ADAPTER_ADDRESSES adapter = adapterList; adapter;
-             adapter = adapter->Next) {
-            if (adapter->OperStatus != IfOperStatusUp ||
-                !adapter->FirstUnicastAddress ||
-                adapter->IfType == IF_TYPE_SOFTWARE_LOOPBACK ||
-                CheckICSGateway(adapter) ) {
-                continue;
-            }
-
-            // Add chars from AdapterName to the checksum.
-            for (int i = 0; adapter->AdapterName[i]; ++i) {
-                sum <<= 2;
-                sum += adapter->AdapterName[i];
-            }
-
-            // Add bytes from each socket address to the checksum.
-            for (PIP_ADAPTER_UNICAST_ADDRESS pip = adapter->FirstUnicastAddress;
-                 pip; pip = pip->Next) {
-                SOCKET_ADDRESS *sockAddr = &pip->Address;
-                for (int i = 0; i < sockAddr->iSockaddrLength; ++i) {
-                    sum += (reinterpret_cast<unsigned char *>
-                            (sockAddr->lpSockaddr))[i];
-                }
-            }
-            linkUp = true;
+        for (ptr = addresses; !linkUp && ptr; ptr = ptr->Next) {
+            if (ptr->OperStatus == IfOperStatusUp &&
+                    ptr->IfType != IF_TYPE_SOFTWARE_LOOPBACK &&
+                    !CheckIsGateway(ptr))
+                linkUp = true;
         }
         mLinkUp = linkUp;
         mStatusKnown = true;
     }
-    free(adapterList);
-
-    if (mLinkUp) {
-        /* Store the checksum only if one or more interfaces are up */
-        mIPInterfaceChecksum = sum;
-    }
+    free(addresses);
 
     CoUninitialize();
 
     return ret;
 }
 
 /**
  * Checks the status of all network adapters.  If one is up and has a valid IP
  * address, sets mLinkUp to true.  Sets mStatusKnown to true if the link status
  * is definitive.
  */
 void
 nsNotifyAddrListener::CheckLinkStatus(void)
 {
     DWORD ret;
     const char *event;
-    bool prevLinkUp = mLinkUp;
-    ULONG prevCsum = mIPInterfaceChecksum;
 
-    // The CheckAdaptersAddresses call is very expensive (~650 milliseconds),
-    // so we don't want to call it synchronously. Instead, we just start up
-    // assuming we have a network link, but we'll report that the status is
-    // unknown.
+    // This call is very expensive (~650 milliseconds), so we don't want to
+    // call it synchronously. Instead, we just start up assuming we have a
+    // network link, but we'll report that the status is unknown.
     if (NS_IsMainThread()) {
         NS_WARNING("CheckLinkStatus called on main thread! No check "
                    "performed. Assuming link is up, status is unknown.");
         mLinkUp = true;
-
-        if (!mStatusKnown) {
-            event = NS_NETWORK_LINK_DATA_UNKNOWN;
-        } else if (!prevLinkUp) {
-            event = NS_NETWORK_LINK_DATA_UP;
-        } else {
-            // Known status and it was already UP
-            event = nullptr;
-        }
-
-        if (event) {
-            SendEvent(event);
-        }
     } else {
         ret = CheckAdaptersAddresses();
         if (ret != ERROR_SUCCESS) {
             mLinkUp = true;
         }
+    }
 
-        if (mLinkUp && (prevCsum != mIPInterfaceChecksum)) {
-            // Network is online. Topology has changed. Always send CHANGED
-            // before UP - if allowed to.
-            if (mAllowChangedEvent) {
-                SendEvent(NS_NETWORK_LINK_DATA_CHANGED);
-            }
-        }
-        if (prevLinkUp != mLinkUp) {
-            // UP/DOWN status changed, send appropriate UP/DOWN event
-            SendEvent(mLinkUp ?
-                      NS_NETWORK_LINK_DATA_UP : NS_NETWORK_LINK_DATA_DOWN);
-        }
-    }
+    if (mStatusKnown)
+        event = mLinkUp ? NS_NETWORK_LINK_DATA_UP : NS_NETWORK_LINK_DATA_DOWN;
+    else
+        event = NS_NETWORK_LINK_DATA_UNKNOWN;
+    SendEventToUI(event);
 }
--- a/netwerk/system/win32/nsNotifyAddrListener.h
+++ b/netwerk/system/win32/nsNotifyAddrListener.h
@@ -25,17 +25,16 @@ public:
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSINETWORKLINKSERVICE
     NS_DECL_NSIRUNNABLE
     NS_DECL_NSIOBSERVER
 
     nsNotifyAddrListener();
 
     nsresult Init(void);
-    void CheckLinkStatus(void);
 
 protected:
     class ChangeEvent : public nsRunnable {
     public:
         NS_DECL_NSIRUNNABLE
         ChangeEvent(nsINetworkLinkService *aService, const char *aEventID)
             : mService(aService), mEventID(aEventID) {
         }
@@ -44,30 +43,21 @@ protected:
         const char *mEventID;
     };
 
     bool mLinkUp;
     bool mStatusKnown;
     bool mCheckAttempted;
 
     nsresult Shutdown(void);
-    nsresult SendEvent(const char *aEventID);
+    nsresult SendEventToUI(const char *aEventID);
 
     DWORD CheckAdaptersAddresses(void);
-
-    // Checks for an Internet Connection Sharing (ICS) gateway.
-    bool  CheckICSGateway(PIP_ADAPTER_ADDRESSES aAdapter);
+    bool  CheckIsGateway(PIP_ADAPTER_ADDRESSES aAdapter);
     bool  CheckICSStatus(PWCHAR aAdapterName);
+    void  CheckLinkStatus(void);
 
     nsCOMPtr<nsIThread> mThread;
 
     HANDLE        mShutdownEvent;
-
-private:
-    // This is a checksum of various meta data for all network interfaces
-    // considered UP at last check.
-    ULONG mIPInterfaceChecksum;
-
-    // Network changed events are enabled
-    bool mAllowChangedEvent;
 };
 
 #endif /* NSNOTIFYADDRLISTENER_H_ */
--- a/netwerk/test/unit/test_ping_aboutnetworking.js
+++ b/netwerk/test/unit/test_ping_aboutnetworking.js
@@ -37,22 +37,16 @@ function test_sockets(serverSocket) {
     do_check_eq(data.sockets[index].port, serverSocket.port);
     do_check_eq(data.sockets[index].tcp, 1);
 
     do_test_finished();
   });
 }
 
 function run_test() {
-  var ps = Cc["@mozilla.org/preferences-service;1"]
-    .getService(Ci.nsIPrefBranch);
-  // disable network changed events to avoid the the risk of having the dns
-  // cache getting flushed behind our back
-  ps.setBoolPref("network.notify.changed", false);
-
   let serverSocket = Components.classes["@mozilla.org/network/server-socket;1"]
     .createInstance(Ci.nsIServerSocket);
   serverSocket.init(-1, true, -1);
 
   do_test_pending();
   gDashboard.requestConnection("localhost", serverSocket.port,
                                "tcp", 15, function(connInfo) {
     if (connInfo.status == "NS_NET_STATUS_CONNECTED_TO") {
--- a/netwerk/test/unit/test_proxy-failover_passing.js
+++ b/netwerk/test/unit/test_proxy-failover_passing.js
@@ -31,17 +31,14 @@ function run_test()
   var prefserv = Cc["@mozilla.org/preferences-service;1"].
                  getService(Ci.nsIPrefService);
   var prefs = prefserv.getBranch("network.proxy.");
   prefs.setIntPref("type", 2);
   prefs.setCharPref("autoconfig_url", "data:text/plain," +
     "function FindProxyForURL(url, host) {return 'PROXY a_non_existent_domain_x7x6c572v:80; PROXY localhost:" +
     httpServer.identity.primaryPort + "';}"
   );
-  // disable network changed events to avoid the the risk of having the 
-  // proxyservice reset in the middle
-  prefserv.setBoolPref("network.notify.changed", false);
 
   var chan = make_channel("http://localhost:" +
                           httpServer.identity.primaryPort + "/content");
   chan.asyncOpen(new ChannelListener(finish_test, null), null);
   do_test_pending();
 }