Bug 1272585 - Start handling NS_ERROR_DOCUMENT_NOT_CACHED the same way as network offline in app update. r=mhowell, a=gchang
authorStephen A Pohl <spohl.mozilla.bugs@gmail.com>
Mon, 27 Jun 2016 15:02:58 -0400
changeset 340067 90964ed0b53027ef9ee5f07452130f45ea7d7e21
parent 340066 cf366a3b54d26733dc13ffbd2a2c5b46e1c7df12
child 340068 d1475df3d7295b385f8b7d2c2b8aa458e9982661
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell, gchang
bugs1272585
milestone49.0a2
Bug 1272585 - Start handling NS_ERROR_DOCUMENT_NOT_CACHED the same way as network offline in app update. r=mhowell, a=gchang
toolkit/mozapps/update/nsUpdateService.js
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -4228,42 +4228,43 @@ Downloader.prototype = {
         // The online observer will continue the incremental download by
         // calling downloadUpdate on the active update which continues
         // downloading the file from where it was.
         LOG("Downloader:onStopRequest - offline, register online observer: true");
         AUSTLMY.pingDownloadCode(this.isCompleteUpdate,
                                  AUSTLMY.DWNLD_RETRY_OFFLINE);
         shouldRegisterOnlineObserver = true;
         deleteActiveUpdate = false;
-      // Each of NS_ERROR_NET_TIMEOUT, ERROR_CONNECTION_REFUSED, and
-      // NS_ERROR_NET_RESET can be returned when disconnecting the internet while
-      // a download of a MAR is in progress.  There may be others but I have not
-      // encountered them during testing.
+      // Each of NS_ERROR_NET_TIMEOUT, ERROR_CONNECTION_REFUSED,
+      // NS_ERROR_NET_RESET and NS_ERROR_DOCUMENT_NOT_CACHED can be returned
+      // when disconnecting the internet while a download of a MAR is in
+      // progress.  There may be others but I have not encountered them during
+      // testing.
       } else if ((status == Cr.NS_ERROR_NET_TIMEOUT ||
                   status == Cr.NS_ERROR_CONNECTION_REFUSED ||
-                  status == Cr.NS_ERROR_NET_RESET) &&
+                  status == Cr.NS_ERROR_NET_RESET ||
+                  status == Cr.NS_ERROR_DOCUMENT_NOT_CACHED) &&
                  this.updateService._consecutiveSocketErrors < maxFail) {
         LOG("Downloader:onStopRequest - socket error, shouldRetrySoon: true");
         let dwnldCode = AUSTLMY.DWNLD_RETRY_CONNECTION_REFUSED;
         if (status == Cr.NS_ERROR_NET_TIMEOUT) {
           dwnldCode = AUSTLMY.DWNLD_RETRY_NET_TIMEOUT;
         } else if (status == Cr.NS_ERROR_NET_RESET) {
           dwnldCode = AUSTLMY.DWNLD_RETRY_NET_RESET;
+        } else if (status == Cr.NS_ERROR_DOCUMENT_NOT_CACHED) {
+          dwnldCode = AUSTLMY.DWNLD_ERR_DOCUMENT_NOT_CACHED;
         }
         AUSTLMY.pingDownloadCode(this.isCompleteUpdate, dwnldCode);
         shouldRetrySoon = true;
         deleteActiveUpdate = false;
       } else if (status != Cr.NS_BINDING_ABORTED &&
-                 status != Cr.NS_ERROR_ABORT &&
-                 status != Cr.NS_ERROR_DOCUMENT_NOT_CACHED) {
+                 status != Cr.NS_ERROR_ABORT) {
         LOG("Downloader:onStopRequest - non-verification failure");
-        let dwnldCode = AUSTLMY.DWNLD_ERR_DOCUMENT_NOT_CACHED;
-        if (status == Cr.NS_BINDING_ABORTED) {
-          dwnldCode = AUSTLMY.DWNLD_ERR_BINDING_ABORTED;
-        } else if (status == Cr.NS_ERROR_ABORT) {
+        let dwnldCode = AUSTLMY.DWNLD_ERR_BINDING_ABORTED;
+        if (status == Cr.NS_ERROR_ABORT) {
           dwnldCode = AUSTLMY.DWNLD_ERR_ABORT;
         }
         AUSTLMY.pingDownloadCode(this.isCompleteUpdate, dwnldCode);
 
         // Some sort of other failure, log this in the |statusText| property
         state = STATE_DOWNLOAD_FAILED;
 
         // XXXben - if |request| (The Incremental Download) provided a means