From bfea3be2f7482cf7a681fc81b1a8eb88260cca6f Mon Sep 17 00:00:00 2001 From: elawrence Date: Tue, 21 Mar 2017 22:23:48 -0700 Subject: [PATCH] [DevTools] Fallback to MainFrameNavigated event url in Security panel If a HTTPS connection is blocked for security reasons, an interstitial is presented and the Network Manager does not raise a ResponseReceived event. Previously, the lack of a matching ResponseReceived event would prevent the MainFrameNavigated event from correctly setting the "Main Origin" for the sidebar. With this CL, if the main navigation request was not previously captured by the ResponseReceived event, we will instead compute the Main Origin by looking at the URL in the MainFrameNavigated event itself. BUG=669309 TEST=blink_layouttests. Alternatively, open Security Panel. Navigate through https://expired.badssl.com/ interstitial. Verify Main Origin appears in sidebar. Review-Url: https://codereview.chromium.org/2756983002 Cr-Commit-Position: refs/heads/master@{#458639} --- front_end/security/SecurityPanel.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/front_end/security/SecurityPanel.js b/front_end/security/SecurityPanel.js index 46d6acf92f..b33cdad847 100644 --- a/front_end/security/SecurityPanel.js +++ b/front_end/security/SecurityPanel.js @@ -350,11 +350,14 @@ Security.SecurityPanel = class extends UI.PanelWithSidebar { // explanations to reflect the new counts. this._mainView.refreshExplanations(); - if (request) { - var origin = Common.ParsedURL.extractOrigin(request.url()); - this._sidebarTree.setMainOrigin(origin); + // If we could not find a matching request (as in the case of clicking + // through an interstitial, see crbug.com/669309), set the origin based upon + // the url data from the MainFrameNavigated event itself. + let origin = Common.ParsedURL.extractOrigin(request ? request.url() : frame.url); + this._sidebarTree.setMainOrigin(origin); + + if (request) this._processRequest(request); - } } _onInterstitialShown() {