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

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: floors 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..847b5030ad966e04b20696bfaadbd6a966ad43c8 100644
--- a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
@@ -257,9 +257,7 @@ WebInspector.SecurityPanel.prototype = {
if (this._target)
return;
- this._target = target;
-
- var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(this._target);
+ 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);
@@ -267,11 +265,16 @@ WebInspector.SecurityPanel.prototype = {
}
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) {
+ 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)
+ securityModel.addEventListener(WebInspector.SecurityModel.Events.SecurityStateChanged, this._onSecurityStateChanged, this);
+
+ this._target = target;
},
/**
@@ -280,6 +283,27 @@ WebInspector.SecurityPanel.prototype = {
*/
targetRemoved: function(target)
{
+ if (this._target !== target)
+ return;
+
+ delete this._target;
+
+ var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(target);
dgozman 2016/10/14 18:33:34 Instead of all this, we can use WebInspector.Event
pfeldman 2016/10/14 20:03:22 Done.
+ if (resourceTreeModel) {
+ resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.Events.MainFrameNavigated, this._onMainFrameNavigated, this);
+ resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.Events.InterstitialShown, this._onInterstitialShown, this);
+ resourceTreeModel.removeEventListener(WebInspector.ResourceTreeModel.Events.InterstitialHidden, this._onInterstitialHidden, this);
+ }
+
+ var networkManager = WebInspector.NetworkManager.fromTarget(target);
+ if (networkManager) {
+ networkManager.removeEventListener(WebInspector.NetworkManager.Events.ResponseReceived, this._onResponseReceived, this);
+ networkManager.removeEventListener(WebInspector.NetworkManager.Events.RequestFinished, this._onRequestFinished, this);
+ }
+
+ var securityModel = WebInspector.SecurityModel.fromTarget(target);
+ if (securityModel)
+ securityModel.removeEventListener(WebInspector.SecurityModel.Events.SecurityStateChanged, this._onSecurityStateChanged, this);
},
/**

Powered by Google App Engine
This is Rietveld 408576698