Bug 1132693 - navigator.onLine detection not working on Android r=mcmanus
authorValentin Gosu <valentin.gosu@gmail.com>
Mon, 16 Feb 2015 19:25:40 +0200
changeset 229364 91c3193203ecd196906597805231060f7658d8e7
parent 229363 581ed2f292ff6d0fe3cdd6e0c0d0112292cf7947
child 229365 04f861bfe2645e118d05e1d5e1fd285df6619345
push id28287
push userryanvm@gmail.com
push dateTue, 17 Feb 2015 20:08:22 +0000
treeherdermozilla-central@b6c56fab513d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1132693
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1132693 - navigator.onLine detection not working on Android r=mcmanus
netwerk/base/nsIOService.cpp
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -1408,19 +1408,16 @@ nsresult
 nsIOService::OnNetworkLinkEvent(const char *data)
 {
     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.
@@ -1439,26 +1436,25 @@ nsIOService::OnNetworkLinkEvent(const ch
         }
     }
 
     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)) {
+    } else if (!strcmp(data, NS_NETWORK_LINK_DATA_CHANGED) ||
+               !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;
     }
+
     return SetOffline(!isUp);
 }
 
 NS_IMETHODIMP
 nsIOService::EscapeString(const nsACString& aString,
                           uint32_t aEscapeType,
                           nsACString& aResult)
 {