Chromium Code Reviews| Index: Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| diff --git a/Source/devtools/front_end/bindings/ResourceScriptMapping.js b/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| index 88336246748f143c81202cc3158147d444897116..89704ce79830423468db74f6daae63ead55a14d4 100644 |
| --- a/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| +++ b/Source/devtools/front_end/bindings/ResourceScriptMapping.js |
| @@ -239,6 +239,12 @@ WebInspector.ResourceScriptMapping.prototype = { |
| _bindUISourceCodeToScripts: function(uiSourceCode, scripts) |
| { |
| console.assert(scripts.length); |
| + // Due to different listeners order, a script file could be created just before uiSourceCode |
| + // for the corresponding script was created. Check that we don't create scriptFile twice. |
| + var boundScriptFile = this.scriptFile(uiSourceCode); |
| + if (boundScriptFile && boundScriptFile.hasScripts(scripts)) |
| + return; |
| + |
| var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode, scripts); |
| this._setScriptFile(uiSourceCode, scriptFile); |
| for (var i = 0; i < scripts.length; ++i) |
| @@ -310,6 +316,15 @@ WebInspector.ResourceScriptFile.Events = { |
| WebInspector.ResourceScriptFile.prototype = { |
| /** |
| + * @param {!Array.<!WebInspector.Script>} scripts |
| + * @return {boolean} |
| + */ |
| + hasScripts: function(scripts) |
| + { |
| + return this._script && this._script === scripts[0]; |
|
pfeldman
2015/08/12 23:38:42
This method name does not make sense to me. Why sh
dgozman
2015/08/13 18:27:26
Please see the constructor of this object. If you
|
| + }, |
| + |
| + /** |
| * @param {function(?string,!DebuggerAgent.SetScriptSourceError=,!WebInspector.Script=)=} callback |
| */ |
| commitLiveEdit: function(callback) |