Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js

Issue 1938183003: Security panel: add listeners only to the added target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
index 82dbe3b343057331222e4bd7dd7199ece3ad1a68..2c61afd1d7fdec33c01500eeb4dbfb9add35cdc3 100644
--- a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
@@ -23,16 +23,11 @@ WebInspector.SecurityPanel = function()
/** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPanel.OriginState>} */
this._origins = new Map();
- WebInspector.targetManager.addModelListener(WebInspector.ResourceTreeModel, WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._onMainFrameNavigated, this);
/** @type {!Map<!WebInspector.NetworkLogView.MixedContentFilterValues, number>} */
this._filterRequestCounts = new Map();
WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Page);
-
- WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, WebInspector.NetworkManager.EventTypes.ResponseReceived, this._onResponseReceived, this);
- WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, WebInspector.NetworkManager.EventTypes.RequestFinished, this._onRequestFinished, this);
- WebInspector.targetManager.addModelListener(WebInspector.SecurityModel, WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
}
/** @typedef {string} */
@@ -248,7 +243,17 @@ WebInspector.SecurityPanel.prototype = {
*/
targetAdded: function(target)
{
- WebInspector.SecurityModel.fromTarget(target);
+ if (this._target)
+ return;
+
+ this._target = target;
+
+ target.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._onMainFrameNavigated, this);
+ target.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResponseReceived, this._onResponseReceived, this);
+ target.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished, this._onRequestFinished, this);
+
+ var securityModel = WebInspector.SecurityModel.fromTarget(target);
+ securityModel.addEventListener(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
},
/**
@@ -277,11 +282,12 @@ WebInspector.SecurityPanel.prototype = {
var request = this._lastResponseReceivedForLoaderId.get(frame.loaderId);
this._clearOrigins();
- var origin = WebInspector.ParsedURL.splitURLIntoPathComponents(request.url)[0];
- this._sidebarTree.setMainOrigin(origin);
- if (request)
+ if (request) {
+ var origin = WebInspector.ParsedURL.splitURLIntoPathComponents(request.url)[0];
+ this._sidebarTree.setMainOrigin(origin);
this._processRequest(request);
+ }
},
__proto__: WebInspector.PanelWithSidebar.prototype
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698