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..c260c8b95afe350f7040627404234da541308768 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/bindings/StylesSourceMapping.js |
| @@ -44,13 +44,13 @@ WebInspector.StylesSourceMapping = function(cssModel, workspace, networkMapping) |
| 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._cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetChanged, this._styleSheetChanged, this); |
| + WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.MainFrameNavigated, this._unbindAllUISourceCodes, this); |
|
dgozman
2016/08/19 20:23:37
This class wants to listen to specific resourceTre
eostroukhov
2016/08/20 01:22:30
Done.
|
| } |
| WebInspector.StylesSourceMapping.ChangeUpdateTimeoutMs = 200; |
| @@ -180,8 +180,13 @@ WebInspector.StylesSourceMapping.prototype = { |
| this._styleFiles.delete(uiSourceCode); |
| }, |
| - _unbindAllUISourceCodes: function() |
| + /** |
| + * @param {!WebInspector.Event} event |
| + */ |
| + _unbindAllUISourceCodes: function(event) |
| { |
| + if (event.data.target() !== this.target()) |
| + return; |
| for (var styleFile of this._styleFiles.values()) |
| styleFile.dispose(); |
| this._styleFiles.clear(); |