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