Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js |
| index d02ce0a5f8de7668078bb081ce7cd6fe1b16fb33..43a05a84b7938c7d4f640d162cd1069a7fc127a4 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js |
| @@ -39,18 +39,19 @@ WebInspector.StylesSourceMapping = function(cssModel, workspace, networkMapping) |
| { |
| this._cssModel = cssModel; |
| this._workspace = workspace; |
| - this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved, this._projectRemoved, this); |
| - this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); |
| - this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this); |
| this._networkMapping = networkMapping; |
| - cssModel.target().resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._unbindAllUISourceCodes, this); |
| - |
| - this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetChanged, this._styleSheetChanged, this); |
| /** @type {!Map<string, !Map<string, !Map<string, !WebInspector.CSSStyleSheetHeader>>>} */ |
| this._urlToHeadersByFrameId = new Map(); |
| /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.StyleFile>} */ |
| this._styleFiles = new Map(); |
| + |
| + this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved, this._projectRemoved, this); |
| + this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); |
| + this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this); |
| + this._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetChanged, this._styleSheetChanged, this); |
| + WebInspector.ResourceTreeModel.fromTarget(cssModel.target()).addEventListener( |
| + WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._unbindAllUISourceCodes, this); |
| } |
| WebInspector.StylesSourceMapping.ChangeUpdateTimeoutMs = 200; |
| @@ -180,8 +181,13 @@ WebInspector.StylesSourceMapping.prototype = { |
| this._styleFiles.delete(uiSourceCode); |
| }, |
| - _unbindAllUISourceCodes: function() |
| + /** |
| + * @param {!WebInspector.Event} event |
| + */ |
| + _unbindAllUISourceCodes: function(event) |
| { |
| + if (event.data.target() !== this.target()) |
|
dgozman
2016/08/20 01:32:00
Drop this check.
eostroukhov-old
2016/08/22 17:55:41
Done.
|
| + return; |
| for (var styleFile of this._styleFiles.values()) |
| styleFile.dispose(); |
| this._styleFiles.clear(); |