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 | |
246 var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode,
scripts); | 242 var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode,
scripts); |
247 this._setScriptFile(uiSourceCode, scriptFile); | 243 this._setScriptFile(uiSourceCode, scriptFile); |
248 for (var i = 0; i < scripts.length; ++i) | 244 for (var i = 0; i < scripts.length; ++i) |
249 this._debuggerWorkspaceBinding.updateLocations(scripts[i]); | 245 this._debuggerWorkspaceBinding.updateLocations(scripts[i]); |
250 this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCo
de, this); | 246 this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCo
de, this); |
251 this._boundURLs.add(this._networkMapping.networkURL(uiSourceCode)); | 247 this._boundURLs.add(this._networkMapping.networkURL(uiSourceCode)); |
252 }, | 248 }, |
253 | 249 |
254 /** | 250 /** |
255 * @param {!WebInspector.UISourceCode} uiSourceCode | 251 * @param {!WebInspector.UISourceCode} uiSourceCode |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 this._update(); | 303 this._update(); |
308 } | 304 } |
309 | 305 |
310 WebInspector.ResourceScriptFile.Events = { | 306 WebInspector.ResourceScriptFile.Events = { |
311 DidMergeToVM: "DidMergeToVM", | 307 DidMergeToVM: "DidMergeToVM", |
312 DidDivergeFromVM: "DidDivergeFromVM", | 308 DidDivergeFromVM: "DidDivergeFromVM", |
313 } | 309 } |
314 | 310 |
315 WebInspector.ResourceScriptFile.prototype = { | 311 WebInspector.ResourceScriptFile.prototype = { |
316 /** | 312 /** |
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 /** | |
329 * @param {function(?string,!DebuggerAgent.SetScriptSourceError=,!WebInspect
or.Script=)=} callback | 313 * @param {function(?string,!DebuggerAgent.SetScriptSourceError=,!WebInspect
or.Script=)=} callback |
330 */ | 314 */ |
331 commitLiveEdit: function(callback) | 315 commitLiveEdit: function(callback) |
332 { | 316 { |
333 /** | 317 /** |
334 * @param {?string} error | 318 * @param {?string} error |
335 * @param {!DebuggerAgent.SetScriptSourceError=} errorData | 319 * @param {!DebuggerAgent.SetScriptSourceError=} errorData |
336 * @this {WebInspector.ResourceScriptFile} | 320 * @this {WebInspector.ResourceScriptFile} |
337 */ | 321 */ |
338 function innerCallback(error, errorData) | 322 function innerCallback(error, errorData) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 */ | 448 */ |
465 addSourceMapURL: function(sourceMapURL) | 449 addSourceMapURL: function(sourceMapURL) |
466 { | 450 { |
467 if (!this._script) | 451 if (!this._script) |
468 return; | 452 return; |
469 this._script.addSourceMapURL(sourceMapURL); | 453 this._script.addSourceMapURL(sourceMapURL); |
470 }, | 454 }, |
471 | 455 |
472 __proto__: WebInspector.Object.prototype | 456 __proto__: WebInspector.Object.prototype |
473 } | 457 } |
OLD | NEW |