Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/resources/DOMStorageModel.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/resources/DOMStorageModel.js b/third_party/WebKit/Source/devtools/front_end/resources/DOMStorageModel.js |
| index ea87c7b0c54b77da56714d4fdbc01b548a5f8714..8218b4994ecd6a9107faf8b68ee5dad050ca38fd 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/resources/DOMStorageModel.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/resources/DOMStorageModel.js |
| @@ -110,11 +110,13 @@ WebInspector.DOMStorage.prototype = { |
| * @constructor |
| * @extends {WebInspector.SDKModel} |
| * @param {!WebInspector.Target} target |
| + * @param {!WebInspector.SecurityOriginManager} securityOriginManager |
| */ |
| -WebInspector.DOMStorageModel = function(target) |
| +WebInspector.DOMStorageModel = function(target, securityOriginManager) |
| { |
| WebInspector.SDKModel.call(this, WebInspector.DOMStorageModel, target); |
| + this._securityOriginManager = securityOriginManager; |
| /** @type {!Object.<string, !WebInspector.DOMStorage>} */ |
| this._storages = {}; |
| this._agent = target.domstorageAgent(); |
| @@ -132,13 +134,12 @@ WebInspector.DOMStorageModel.prototype = { |
| return; |
| this.target().registerDOMStorageDispatcher(new WebInspector.DOMStorageDispatcher(this)); |
| - this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); |
| - this.target().resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| - this._agent.enable(); |
| + this._securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this); |
| + this._securityOriginManager.addEventListener(WebInspector.SecurityOriginManager.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this); |
| - var securityOrigins = this.target().resourceTreeModel.securityOrigins(); |
| - for (var i = 0; i < securityOrigins.length; ++i) |
| - this._addOrigin(securityOrigins[i]); |
| + for (var securityOrigin of this._securityOriginManager.securityOrigins()) |
| + this._addOrigin(securityOrigin); |
| + this._agent.enable(); |
| this._enabled = true; |
| }, |
| @@ -353,14 +354,16 @@ WebInspector.DOMStorageDispatcher.prototype = { |
| } |
| WebInspector.DOMStorageModel._symbol = Symbol("DomStorage"); |
| + |
| /** |
| * @param {!WebInspector.Target} target |
| * @return {!WebInspector.DOMStorageModel} |
| */ |
| WebInspector.DOMStorageModel.fromTarget = function(target) |
| { |
| - if (!target[WebInspector.DOMStorageModel._symbol]) |
| - target[WebInspector.DOMStorageModel._symbol] = new WebInspector.DOMStorageModel(target); |
| + if (!target[WebInspector.DOMStorageModel._symbol]) { |
| + target[WebInspector.DOMStorageModel._symbol] = new WebInspector.DOMStorageModel(target, WebInspector.SecurityOriginManager.fromTarget(target)); |
|
dgozman
2016/07/25 18:56:08
Let's use target.model().
eostroukhov-old
2016/07/25 19:47:48
Done.
|
| + } |
| return target[WebInspector.DOMStorageModel._symbol]; |
| } |