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

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

Issue 2419943003: DevTools: allow handing over the raw protocol connection to external clients and back. (Closed)
Patch Set: rebaselined Created 4 years, 2 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
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 a96834de5db7e5efed5a21243c0c2666b587398a..45c96b66757af77141fad489de348174817785a3 100644
--- a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
@@ -26,6 +26,8 @@ WebInspector.SecurityPanel = function()
/** @type {!Map<!WebInspector.NetworkLogView.MixedContentFilterValues, number>} */
this._filterRequestCounts = new Map();
+ /** @type {!Map<!WebInspector.Target, !Array<!WebInspector.EventTarget.EventDescriptor>>}*/
+ this._eventListeners = new Map();
WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.Network);
}
@@ -257,21 +259,33 @@ WebInspector.SecurityPanel.prototype = {
if (this._target)
return;
- this._target = target;
-
- var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._target);
+ var listeners = [];
+ var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
if (resourceTreeModel) {
- resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNavigated, this);
- resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.InterstitialShown, this._onInterstitialShown, this);
- resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.InterstitialHidden, this._onInterstitialHidden, this);
+ listeners = listeners.concat([
+ resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNavigated, this),
+ resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.InterstitialShown, this._onInterstitialShown, this),
+ resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.Events.InterstitialHidden, this._onInterstitialHidden, this),
+ ]);
}
var networkManager = WebInspector.NetworkManager.fromTarget(target);
- networkManager.addEventListener(WebInspector.NetworkManager.Events.ResponseReceived, this._onResponseReceived, this);
- networkManager.addEventListener(WebInspector.NetworkManager.Events.RequestFinished, this._onRequestFinished, this);
+ if (networkManager) {
+ listeners = listeners.concat([
+ networkManager.addEventListener(WebInspector.NetworkManager.Events.ResponseReceived, this._onResponseReceived, this),
+ networkManager.addEventListener(WebInspector.NetworkManager.Events.RequestFinished, this._onRequestFinished, this),
+ ]);
+ }
var securityModel = WebInspector.SecurityModel.fromTarget(target);
- securityModel.addEventListener(WebInspector.SecurityModel.Events.SecurityStateChanged, this._onSecurityStateChanged, this);
+ if (securityModel) {
+ listeners = listeners.concat([
+ securityModel.addEventListener(WebInspector.SecurityModel.Events.SecurityStateChanged, this._onSecurityStateChanged, this)
+ ]);
+ }
+
+ this._target = target;
+ this._eventListeners.set(target, listeners);
},
/**
@@ -280,6 +294,13 @@ WebInspector.SecurityPanel.prototype = {
*/
targetRemoved: function(target)
{
+ if (this._target !== target)
+ return;
+
+ delete this._target;
+
+ WebInspector.EventTarget.removeEventListeners(this._eventListeners.get(target));
+ this._eventListeners.delete(target);
},
/**

Powered by Google App Engine
This is Rietveld 408576698