Bug 1468830 - Ignore exceptions when retreiving response headers. r=rpl, a=RyanVM
authorShane Caraveo <scaraveo@mozilla.com>
Thu, 14 Jun 2018 12:42:52 -0700
changeset 449538 5b7e2a2b06e1a3ecc50bc566eb733cba085e8357
parent 449537 e4e7bbcff4e3ea7d786c1b5a6bf2046eace7ff83
child 449539 45689b759100952aa0f9dfbb0bbda44aa581c174
push id90
push userryanvm@gmail.com
push dateFri, 15 Jun 2018 15:45:21 +0000
treeherdermozilla-esr60@5b7e2a2b06e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl, RyanVM
bugs1468830
milestone60.0.3
Bug 1468830 - Ignore exceptions when retreiving response headers. r=rpl, a=RyanVM MozReview-Commit-ID: Dw4X1q15NHv
toolkit/modules/addons/WebRequest.jsm
--- a/toolkit/modules/addons/WebRequest.jsm
+++ b/toolkit/modules/addons/WebRequest.jsm
@@ -755,18 +755,20 @@ HttpObserverManager = {
         }
 
         if (opts.requestHeaders) {
           requestHeaders = requestHeaders || new RequestHeaderChanger(channel);
           data.requestHeaders = requestHeaders.toArray();
         }
 
         if (opts.responseHeaders) {
-          responseHeaders = responseHeaders || new ResponseHeaderChanger(channel);
-          data.responseHeaders = responseHeaders.toArray();
+          try {
+            responseHeaders = responseHeaders || new ResponseHeaderChanger(channel);
+            data.responseHeaders = responseHeaders.toArray();
+          } catch (e) { /* headers may not be available on some redirects */ }
         }
 
         if (opts.requestBody && channel.canModify) {
           requestBody = requestBody || WebRequestUpload.createRequestBody(channel.channel);
           data.requestBody = requestBody;
         }
 
         try {