Bug 1416295 - Support downloading updates from servers that don't support resuming. r=dthayer
authorMatt Howell <mhowell@mozilla.com>
Fri, 10 Nov 2017 09:54:13 -0800
changeset 444616 df5703f27971c564a5f50ff8eede2042bbd9d005
parent 444615 c6099f497e320e73f5e665f2d55b8dbd2dac8948
child 444617 e02d99be7eb02399c057b77d3b1c9c6cda054ef5
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdthayer
bugs1416295
milestone58.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 1416295 - Support downloading updates from servers that don't support resuming. r=dthayer 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;