Bug 1640099 - imported patch always-set-reason.diff r=bomsy
authorJan Odvarko <odvarko@gmail.com>
Fri, 22 May 2020 16:04:16 +0000
changeset 531765 9036936c19083338f16eb8f5ff7c8fc127ba66c1
parent 531764 b52897fc2bd16b6fe58ee20c18442d48cd79c7c9
child 531766 9259663203fe0563a61ddb727d2f66af5d629170
push id37443
push usercbrindusan@mozilla.com
push dateSat, 23 May 2020 21:42:57 +0000
treeherdermozilla-central@9a2f741cef6a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbomsy
bugs1640099
milestone78.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 1640099 - imported patch always-set-reason.diff r=bomsy Differential Revision: https://phabricator.services.mozilla.com/D76448
devtools/server/actors/network-monitor/network-response-listener.js
--- a/devtools/server/actors/network-monitor/network-response-listener.js
+++ b/devtools/server/actors/network-monitor/network-response-listener.js
@@ -519,16 +519,22 @@ NetworkResponseListener.prototype = {
       // WebExtensionPolicy is not available for workers
       if (typeof WebExtensionPolicy !== "undefined") {
         id = WebExtensionPolicy.getByID(id).name;
       }
     } catch (err) {
       // "cancelledByExtension" doesn't have to be available.
     }
 
+    // The request is canceled, so make sure the reason is always set.
+    // (otherwise it wouldn't be marked a blocked in the Network panel)
+    if (this.request.canceled && !reason) {
+      reason = "unknown";
+    }
+
     this.httpActivity.owner.addResponseContent(response, {
       discardResponseBody: this.httpActivity.discardResponseBody,
       truncated: this.truncated,
       blockedReason: reason,
       blockingExtension: id,
     });
 
     this._wrappedNotificationCallbacks = null;