From 789e572738af1b405ed3c2bed77adbb0bf89ecdc Mon Sep 17 00:00:00 2001 From: Bogdan Tara Date: Thu, 20 Aug 2020 03:17:05 +0300 Subject: [PATCH] Backed out changeset c209cb1c0341 (bug 1658146) for browser_resources_network_events.js failures CLOSED TREE --- .../request-details/HeadersPanel.js | 4 +-- .../network-monitor/network-observer.js | 25 +++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/devtools/client/netmonitor/src/components/request-details/HeadersPanel.js b/devtools/client/netmonitor/src/components/request-details/HeadersPanel.js index 17e56fa1663e..4ef1872484b2 100644 --- a/devtools/client/netmonitor/src/components/request-details/HeadersPanel.js +++ b/devtools/client/netmonitor/src/components/request-details/HeadersPanel.js @@ -192,7 +192,7 @@ class HeadersPanel extends Component { urlDetails.url.split( requestHeaders.headers.find(ele => ele.name === "Host").value )[1] - } ${httpVersion || ""}`; + } ${httpVersion}`; result = `${title} (${getFormattedSize( writeHeaderText(requestHeaders.headers, preHeaderText).length, 3 @@ -357,7 +357,7 @@ class HeadersPanel extends Component { urlDetails.url.split( requestHeaders.headers.find(ele => ele.name === "Host").value )[1] - } ${httpVersion || ""}`; + } ${httpVersion}`; value = writeHeaderText(requestHeaders.headers, preHeaderText).trim(); break; case "RESPONSE": diff --git a/devtools/server/actors/network-monitor/network-observer.js b/devtools/server/actors/network-monitor/network-observer.js index cc5d7975051d..85a85ae6a915 100644 --- a/devtools/server/actors/network-monitor/network-observer.js +++ b/devtools/server/actors/network-monitor/network-observer.js @@ -368,25 +368,18 @@ NetworkObserver.prototype = { const httpActivity = this.createOrGetActivityObject(channel); const serverTimings = this._extractServerTimings(channel); - if (!httpActivity.owner) { - // If the owner isn't set we need to create the network event and send - // it to the client. This happens in case where the request has been - // blocked (e.g. CORS) and "http-on-stop-request" is the first notification. - - // Also we need make sure there is a valid reason to block. These reason - // - Either the id is set to a valid string in case of extension blocking - // - Or the reason is set to anything other than 0 (BLOCKING_REASON_NONE) which is default for - // any request (blocked or unblocked). See https://searchfox.org/mozilla-central/rev/23dd7c485a6525bb3a974abeaafaf34bfb43d76b/netwerk/base/nsILoadInfo.idl#1256-1310 for details. - if (reason || id) { - this._createNetworkEvent(subject, { - blockedReason: reason, - blockingExtension: id, - }); - } - } else { + if (httpActivity.owner) { // Try extracting server timings. Note that they will be sent to the client // in the `_onTransactionClose` method together with network event timings. httpActivity.owner.addSeverTimings(serverTimings); + } else { + // If the owner isn't set we need to create the network event and send + // it to the client. This happens in case where the request has been + // blocked (e.g. CORS) and "http-on-stop-request" is the first notification. + this._createNetworkEvent(subject, { + blockedReason: reason, + blockingExtension: id, + }); } },