Bug 1547216 - Make the browser chrome test app_update.sjs handle HEAD requests for BITS downloads. r=bytesized
authorRobert Strong <robert.bugzilla@gmail.com>
Fri, 26 Apr 2019 15:58:46 +0000
changeset 471544 aaec576505b20b6f72dbfae8b6e42cb12b3cdfc0
parent 471543 b19746e81434e5461b91286e93c0918f49c9fae6
child 471545 8cfaa18c3b3b8866ae2ab3a389dd37c5de5e1d3f
push id84149
push userrstrong@mozilla.com
push dateFri, 26 Apr 2019 16:29:45 +0000
treeherderautoland@aaec576505b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1547216
milestone68.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 1547216 - Make the browser chrome test app_update.sjs handle HEAD requests for BITS downloads. r=bytesized Differential Revision: https://phabricator.services.mozilla.com/D28980
toolkit/mozapps/update/tests/browser/app_update.sjs
--- a/toolkit/mozapps/update/tests/browser/app_update.sjs
+++ b/toolkit/mozapps/update/tests/browser/app_update.sjs
@@ -66,20 +66,27 @@ function handleRequest(aRequest, aRespon
   aResponse.setHeader("Cache-Control", "no-cache", false);
 
   // When a mar download is started by the update service it can finish
   // downloading before the ui has loaded. By specifying a serviceURL for the
   // update patch that points to this file and has a slowDownloadMar param the
   // mar will be downloaded asynchronously which will allow the ui to load
   // before the download completes.
   if (params.slowDownloadMar) {
-    let retries = 0;
     aResponse.processAsync();
     aResponse.setHeader("Content-Type", "binary/octet-stream");
     aResponse.setHeader("Content-Length", SIZE_SIMPLE_MAR);
+
+    // BITS will first make a HEAD request followed by a GET request.
+    if (aRequest.method == "HEAD") {
+      aResponse.finish();
+      return;
+    }
+
+    let retries = 0;
     gSlowDownloadTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     gSlowDownloadTimer.initWithCallback(function(aTimer) {
       let continueFile = getTestDataFile(CONTINUE_DOWNLOAD);
       retries++;
       if (continueFile.exists() || retries == MAX_SLOW_RESPONSE_RETRIES) {
         try {
           // If the continue file is in use try again the next time the timer
           // fires unless the retries has reached the value defined by