Chromium Code Reviews| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 * @return {boolean} | 313 * @return {boolean} |
| 314 */ | 314 */ |
| 315 _isDiverged: function() | 315 _isDiverged: function() |
| 316 { | 316 { |
| 317 if (this._uiSourceCode.isDirty()) | 317 if (this._uiSourceCode.isDirty()) |
| 318 return true; | 318 return true; |
| 319 if (!this._script) | 319 if (!this._script) |
| 320 return false; | 320 return false; |
| 321 if (typeof this._scriptSource === "undefined") | 321 if (typeof this._scriptSource === "undefined") |
| 322 return false; | 322 return false; |
| 323 if (!this._uiSourceCode.workingCopy().startsWith(this._scriptSource.trim Right())) | 323 var workingCopy = this._uiSourceCode.workingCopy(); |
| 324 return true; | 324 |
| 325 var suffix = this._uiSourceCode.workingCopy().substr(this._scriptSource. length); | 325 // Match ignoring sourceURL. |
| 326 return !!suffix.length && !suffix.match(WebInspector.Script.sourceURLReg ex); | 326 if (workingCopy.startsWith(this._scriptSource.trimRight())) { |
| 327 var suffix = this._uiSourceCode.workingCopy().substr(this._scriptSou rce.length); | |
| 328 return !!suffix.length && !suffix.match(WebInspector.Script.sourceUR LRegex); | |
| 329 } | |
| 330 | |
| 331 // Match ignoring Node wrapper. | |
| 332 var nodePrefix = "(function (exports, require, module, __filename, __dir name) { \n"; | |
|
paulirish
2016/09/21 02:47:58
fwiw: this matches against the node string here:
| |
| 333 var nodeSuffix = "\n});"; | |
| 334 if (workingCopy.startsWith("#!/usr/bin/env node\n")) | |
| 335 workingCopy = workingCopy.substring("#!/usr/bin/env node\n".length); | |
| 336 if (this._scriptSource === nodePrefix + workingCopy + nodeSuffix) | |
| 337 return false; | |
| 338 return true; | |
| 327 }, | 339 }, |
| 328 | 340 |
| 329 /** | 341 /** |
| 330 * @param {!WebInspector.Event} event | 342 * @param {!WebInspector.Event} event |
| 331 */ | 343 */ |
| 332 _workingCopyChanged: function(event) | 344 _workingCopyChanged: function(event) |
| 333 { | 345 { |
| 334 this._update(); | 346 this._update(); |
| 335 }, | 347 }, |
| 336 | 348 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 /** | 484 /** |
| 473 * @return {boolean} | 485 * @return {boolean} |
| 474 */ | 486 */ |
| 475 hasSourceMapURL: function() | 487 hasSourceMapURL: function() |
| 476 { | 488 { |
| 477 return this._script && !!this._script.sourceMapURL; | 489 return this._script && !!this._script.sourceMapURL; |
| 478 }, | 490 }, |
| 479 | 491 |
| 480 __proto__: WebInspector.Object.prototype | 492 __proto__: WebInspector.Object.prototype |
| 481 } | 493 } |
| OLD | NEW |