Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| index d46a02ddb2003d690ec05b11f17c81301166b911..36bad4a2f68a763a542ba350af954a3ea2370b55 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| @@ -42,8 +42,8 @@ WebInspector.ResourceScriptMapping = function(debuggerModel, workspace, networkM |
| this._debuggerModel = debuggerModel; |
| this._networkMapping = networkMapping; |
| this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
| - /** @type {!Array.<!WebInspector.UISourceCode>} */ |
| - this._boundUISourceCodes = []; |
| + /** @type {!Set<!WebInspector.UISourceCode>} */ |
| + this._boundUISourceCodes = new Set(); |
| /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.ResourceScriptFile>} */ |
| this._uiSourceCodeToScriptFile = new Map(); |
| @@ -160,11 +160,8 @@ WebInspector.ResourceScriptMapping.prototype = { |
| _uiSourceCodeAdded: function(event) |
| { |
| var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); |
| - if (!this._networkMapping.networkURL(uiSourceCode)) |
| - return; |
| if (uiSourceCode.isFromServiceProject()) |
| return; |
| - |
| var scripts = this._scriptsForUISourceCode(uiSourceCode); |
| if (!scripts.length) |
| return; |
| @@ -178,9 +175,7 @@ WebInspector.ResourceScriptMapping.prototype = { |
| _uiSourceCodeRemoved: function(event) |
| { |
| var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); |
| - if (!this._networkMapping.networkURL(uiSourceCode)) |
| - return; |
| - if (uiSourceCode.isFromServiceProject()) |
| + if (uiSourceCode.isFromServiceProject() || !this._boundUISourceCodes.has(uiSourceCode)) |
| return; |
| this._unbindUISourceCode(uiSourceCode); |
| @@ -218,9 +213,7 @@ WebInspector.ResourceScriptMapping.prototype = { |
| var target = WebInspector.NetworkProject.targetForUISourceCode(uiSourceCode); |
| if (target && target !== this._debuggerModel.target()) |
|
dgozman
2016/09/27 17:48:24
if (target !== this._debuggerModel.target())
lushnikov
2016/09/28 18:36:02
Done.
|
| return []; |
| - if (!this._networkMapping.networkURL(uiSourceCode)) |
| - return []; |
| - return this._debuggerModel.scriptsForSourceURL(this._networkMapping.networkURL(uiSourceCode)); |
| + return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url()); |
| }, |
| /** |
| @@ -241,7 +234,7 @@ WebInspector.ResourceScriptMapping.prototype = { |
| for (var i = 0; i < scripts.length; ++i) |
| this._debuggerWorkspaceBinding.updateLocations(scripts[i]); |
| this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCode, this); |
| - this._boundUISourceCodes.push(uiSourceCode); |
| + this._boundUISourceCodes.add(uiSourceCode); |
| }, |
| /** |
| @@ -255,14 +248,14 @@ WebInspector.ResourceScriptMapping.prototype = { |
| this._setScriptFile(uiSourceCode, null); |
| } |
| this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCode, null); |
| - this._boundUISourceCodes.remove(uiSourceCode); |
| + this._boundUISourceCodes.delete(uiSourceCode); |
| }, |
| _debuggerReset: function() |
| { |
| - var sourceCodes = this._boundUISourceCodes; |
| - this._boundUISourceCodes = []; |
| - sourceCodes.forEach(this._unbindUISourceCode.bind(this)); |
| + for (var uiSourceCode of this._boundUISourceCodes.valuesArray()) |
| + this._unbindUISourceCode(uiSourceCode); |
| + this._boundUISourceCodes.clear(); |
| console.assert(!this._uiSourceCodeToScriptFile.size); |
| }, |