| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return; | 300 return; |
| 301 } | 301 } |
| 302 | 302 |
| 303 this._scriptSource = source; | 303 this._scriptSource = source; |
| 304 this._update(); | 304 this._update(); |
| 305 } | 305 } |
| 306 if (!this._script) | 306 if (!this._script) |
| 307 return; | 307 return; |
| 308 var source = this._uiSourceCode.workingCopy(); | 308 var source = this._uiSourceCode.workingCopy(); |
| 309 if (this._script.hasSourceURL && !this._sourceEndsWithSourceURL(source)) | 309 if (this._script.hasSourceURL && !this._sourceEndsWithSourceURL(source)) |
| 310 source += "\n //@ sourceURL=" + this._script.sourceURL; | 310 source += "\n //# sourceURL=" + this._script.sourceURL; |
| 311 WebInspector.debuggerModel.setScriptSource(this._script.scriptId, source
, innerCallback.bind(this)); | 311 WebInspector.debuggerModel.setScriptSource(this._script.scriptId, source
, innerCallback.bind(this)); |
| 312 }, | 312 }, |
| 313 | 313 |
| 314 /** | 314 /** |
| 315 * @return {boolean} | 315 * @return {boolean} |
| 316 */ | 316 */ |
| 317 _isDiverged: function() | 317 _isDiverged: function() |
| 318 { | 318 { |
| 319 if (this._uiSourceCode.formatted()) | 319 if (this._uiSourceCode.formatted()) |
| 320 return false; | 320 return false; |
| 321 if (this._uiSourceCode.isDirty()) | 321 if (this._uiSourceCode.isDirty()) |
| 322 return true; | 322 return true; |
| 323 if (!this._script) | 323 if (!this._script) |
| 324 return false; | 324 return false; |
| 325 if (typeof this._scriptSource === "undefined") | 325 if (typeof this._scriptSource === "undefined") |
| 326 return false; | 326 return false; |
| 327 return !this._sourceMatchesScriptSource(this._uiSourceCode.workingCopy()
, this._scriptSource); | 327 return !this._sourceMatchesScriptSource(this._uiSourceCode.workingCopy()
, this._scriptSource); |
| 328 }, | 328 }, |
| 329 | 329 |
| 330 /** | 330 /** |
| 331 * @param {string} source | 331 * @param {string} source |
| 332 * @param {string} scriptSource | 332 * @param {string} scriptSource |
| 333 * @return {boolean} | 333 * @return {boolean} |
| 334 */ | 334 */ |
| 335 _sourceMatchesScriptSource: function(source, scriptSource) | 335 _sourceMatchesScriptSource: function(source, scriptSource) |
| 336 { | 336 { |
| 337 if (!scriptSource.startsWith(source)) | 337 if (!scriptSource.startsWith(source)) |
| 338 return false; | 338 return false; |
| 339 var scriptSourceTail = scriptSource.substr(source.length).trim(); | 339 var scriptSourceTail = scriptSource.substr(source.length).trim(); |
| 340 return !scriptSourceTail || !!scriptSourceTail.match(/^\/\/@\ssourceURL=
\s*(\S*?)\s*$/m); | 340 return !scriptSourceTail || !!scriptSourceTail.match(/^\/\/[@#]\ssourceU
RL=\s*(\S*?)\s*$/m); |
| 341 }, | 341 }, |
| 342 | 342 |
| 343 /** | 343 /** |
| 344 * @param {string} source | 344 * @param {string} source |
| 345 * @return {boolean} | 345 * @return {boolean} |
| 346 */ | 346 */ |
| 347 _sourceEndsWithSourceURL: function(source) | 347 _sourceEndsWithSourceURL: function(source) |
| 348 { | 348 { |
| 349 return !!source.match(/\/\/@\ssourceURL=\s*(\S*?)\s*$/m); | 349 return !!source.match(/\/\/[@#]\ssourceURL=\s*(\S*?)\s*$/m); |
| 350 }, | 350 }, |
| 351 | 351 |
| 352 /** | 352 /** |
| 353 * @param {WebInspector.Event} event | 353 * @param {WebInspector.Event} event |
| 354 */ | 354 */ |
| 355 _workingCopyChanged: function(event) | 355 _workingCopyChanged: function(event) |
| 356 { | 356 { |
| 357 this._update(); | 357 this._update(); |
| 358 }, | 358 }, |
| 359 | 359 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 }, | 428 }, |
| 429 | 429 |
| 430 dispose: function() | 430 dispose: function() |
| 431 { | 431 { |
| 432 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
WorkingCopyCommitted, this._workingCopyCommitted, this); | 432 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
WorkingCopyCommitted, this._workingCopyCommitted, this); |
| 433 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
WorkingCopyChanged, this._workingCopyChanged, this); | 433 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events.
WorkingCopyChanged, this._workingCopyChanged, this); |
| 434 }, | 434 }, |
| 435 | 435 |
| 436 __proto__: WebInspector.Object.prototype | 436 __proto__: WebInspector.Object.prototype |
| 437 } | 437 } |
| OLD | NEW |