Bug 1416295 - Support downloading updates from servers that don't support resuming. draft
authorMatt Howell <mhowell@mozilla.com>
Fri, 10 Nov 2017 09:54:13 -0800
changeset 696449 5c78d2879c89cc5a05c246fbed549b62508df8b4
parent 696426 b0ded9bbd517b1cef61beef4245323d1441fedc3
child 739867 824d2326bb39c7ffc19370c8b5bca6309d11d6a2
push id88724
push usermhowell@mozilla.com
push dateFri, 10 Nov 2017 18:55:24 +0000
bugs1416295
milestone58.0a1
Bug 1416295 - Support downloading updates from servers that don't support resuming. MozReview-Commit-ID: Cw0cUibaD3d
toolkit/mozapps/update/nsUpdateService.js
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -3593,17 +3593,25 @@ class ChannelDownloader extends CommonDo
       return;
     }
 
     LOG("ChannelDownloader:onStartRequest");
 
     this._bkgFileSaver.onStartRequest(request, context);
 
     if (request instanceof Ci.nsIResumableChannel) {
-      this._patch.setProperty("entityID", request.entityID);
+      // Reading the entityID can throw if the server doesn't allow resuming.
+      try {
+        this._patch.setProperty("entityID", request.entityID);
+      } catch (ex) {
+        if (!(ex instanceof Components.Exception) ||
+            ex.result != Cr.NS_ERROR_NOT_RESUMABLE) {
+          throw ex;
+        }
+      }
     }
 
     var um = Cc["@mozilla.org/updates/update-manager;1"].
              getService(Ci.nsIUpdateManager);
     um.saveUpdates();
 
     var listeners = this._listeners.concat();
     var listenerCount = listeners.length;