Commit 71e6f208 authored by lgarron@chromium.org's avatar lgarron@chromium.org

Add model listeners in the Security panel constructor (instead of in targetAdded).

BUG=522762

Review URL: https://codereview.chromium.org/1311013007

git-svn-id: svn://svn.chromium.org/blink/trunk@201603 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 33bea975
...@@ -34,6 +34,9 @@ WebInspector.SecurityPanel = function() ...@@ -34,6 +34,9 @@ WebInspector.SecurityPanel = function()
this._origins = new Map(); this._origins = new Map();
// TODO(lgarron): add event listeners to call _clear() once we figure out how to clear the panel properly (https://crbug.com/522762). // TODO(lgarron): add event listeners to call _clear() once we figure out how to clear the panel properly (https://crbug.com/522762).
WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, WebInspector.NetworkManager.EventTypes.ResponseReceivedSecurityDetails, this._onResponseReceivedSecurityDetails, this);
WebInspector.targetManager.addModelListener(WebInspector.SecurityModel, WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
WebInspector.targetManager.observeTargets(this); WebInspector.targetManager.observeTargets(this);
} }
...@@ -164,16 +167,7 @@ WebInspector.SecurityPanel.prototype = { ...@@ -164,16 +167,7 @@ WebInspector.SecurityPanel.prototype = {
*/ */
targetAdded: function(target) targetAdded: function(target)
{ {
if (!this._target) { WebInspector.SecurityModel.fromTarget(target);
this._target = target;
this._securityModel = WebInspector.SecurityModel.fromTarget(target);
this._securityModel.addEventListener(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
this._updateSecurityState(this._securityModel.securityState(), []);
this._origins.clear();
this._networkManager = target.networkManager;
this._networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResponseReceivedSecurityDetails, this._onResponseReceivedSecurityDetails, this);
}
}, },
/** /**
...@@ -182,14 +176,6 @@ WebInspector.SecurityPanel.prototype = { ...@@ -182,14 +176,6 @@ WebInspector.SecurityPanel.prototype = {
*/ */
targetRemoved: function(target) targetRemoved: function(target)
{ {
if (target === this._target) {
this._securityModel.removeEventListener(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, this._onSecurityStateChanged, this);
delete this._securityModel;
this._networkManager.removeEventListener(WebInspector.NetworkManager.EventTypes.ResponseReceivedSecurityDetails, this._onResponseReceivedSecurityDetails, this);
delete this._networkManager;
delete this._target;
this._clear();
}
}, },
_clear: function() _clear: function()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment