OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 return this._debuggerModel.scriptsForSourceURL(this._networkMapping.netw
orkURL(uiSourceCode)); | 232 return this._debuggerModel.scriptsForSourceURL(this._networkMapping.netw
orkURL(uiSourceCode)); |
233 }, | 233 }, |
234 | 234 |
235 /** | 235 /** |
236 * @param {!WebInspector.UISourceCode} uiSourceCode | 236 * @param {!WebInspector.UISourceCode} uiSourceCode |
237 * @param {!Array.<!WebInspector.Script>} scripts | 237 * @param {!Array.<!WebInspector.Script>} scripts |
238 */ | 238 */ |
239 _bindUISourceCodeToScripts: function(uiSourceCode, scripts) | 239 _bindUISourceCodeToScripts: function(uiSourceCode, scripts) |
240 { | 240 { |
241 console.assert(scripts.length); | 241 console.assert(scripts.length); |
| 242 var boundScriptFile = this.scriptFile(uiSourceCode); |
| 243 if (boundScriptFile && boundScriptFile.hasScripts(scripts)) |
| 244 return; |
| 245 |
242 var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode,
scripts); | 246 var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode,
scripts); |
243 this._setScriptFile(uiSourceCode, scriptFile); | 247 this._setScriptFile(uiSourceCode, scriptFile); |
244 for (var i = 0; i < scripts.length; ++i) | 248 for (var i = 0; i < scripts.length; ++i) |
245 this._debuggerWorkspaceBinding.updateLocations(scripts[i]); | 249 this._debuggerWorkspaceBinding.updateLocations(scripts[i]); |
246 this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCo
de, this); | 250 this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCo
de, this); |
247 this._boundURLs.add(this._networkMapping.networkURL(uiSourceCode)); | 251 this._boundURLs.add(this._networkMapping.networkURL(uiSourceCode)); |
248 }, | 252 }, |
249 | 253 |
250 /** | 254 /** |
251 * @param {!WebInspector.UISourceCode} uiSourceCode | 255 * @param {!WebInspector.UISourceCode} uiSourceCode |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 this._update(); | 307 this._update(); |
304 } | 308 } |
305 | 309 |
306 WebInspector.ResourceScriptFile.Events = { | 310 WebInspector.ResourceScriptFile.Events = { |
307 DidMergeToVM: "DidMergeToVM", | 311 DidMergeToVM: "DidMergeToVM", |
308 DidDivergeFromVM: "DidDivergeFromVM", | 312 DidDivergeFromVM: "DidDivergeFromVM", |
309 } | 313 } |
310 | 314 |
311 WebInspector.ResourceScriptFile.prototype = { | 315 WebInspector.ResourceScriptFile.prototype = { |
312 /** | 316 /** |
| 317 * @param {!Array.<!WebInspector.Script>} scripts |
| 318 * @return {boolean} |
| 319 */ |
| 320 hasScripts: function(scripts) |
| 321 { |
| 322 var script; |
| 323 if (this._uiSourceCode.contentType() === WebInspector.resourceTypes.Scri
pt) |
| 324 script = scripts[0]; |
| 325 return this._script === script; |
| 326 }, |
| 327 |
| 328 /** |
313 * @param {function(?string,!DebuggerAgent.SetScriptSourceError=,!WebInspect
or.Script=)=} callback | 329 * @param {function(?string,!DebuggerAgent.SetScriptSourceError=,!WebInspect
or.Script=)=} callback |
314 */ | 330 */ |
315 commitLiveEdit: function(callback) | 331 commitLiveEdit: function(callback) |
316 { | 332 { |
317 /** | 333 /** |
318 * @param {?string} error | 334 * @param {?string} error |
319 * @param {!DebuggerAgent.SetScriptSourceError=} errorData | 335 * @param {!DebuggerAgent.SetScriptSourceError=} errorData |
320 * @this {WebInspector.ResourceScriptFile} | 336 * @this {WebInspector.ResourceScriptFile} |
321 */ | 337 */ |
322 function innerCallback(error, errorData) | 338 function innerCallback(error, errorData) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 */ | 464 */ |
449 addSourceMapURL: function(sourceMapURL) | 465 addSourceMapURL: function(sourceMapURL) |
450 { | 466 { |
451 if (!this._script) | 467 if (!this._script) |
452 return; | 468 return; |
453 this._script.addSourceMapURL(sourceMapURL); | 469 this._script.addSourceMapURL(sourceMapURL); |
454 }, | 470 }, |
455 | 471 |
456 __proto__: WebInspector.Object.prototype | 472 __proto__: WebInspector.Object.prototype |
457 } | 473 } |
OLD | NEW |