OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 * Number of source lines. | 431 * Number of source lines. |
432 */ | 432 */ |
433 Script.prototype.lineCount = function() { | 433 Script.prototype.lineCount = function() { |
434 // Return number of source lines. | 434 // Return number of source lines. |
435 return this.line_ends.length; | 435 return this.line_ends.length; |
436 }; | 436 }; |
437 | 437 |
438 | 438 |
439 /** | 439 /** |
440 * Returns the name of script if available, contents of sourceURL comment | 440 * Returns the name of script if available, contents of sourceURL comment |
441 * otherwise. See | 441 * otherwise. See |
442 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt | 442 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt |
443 * for details on using //@ sourceURL comment to identify scritps that don't | 443 * for details on using //@ sourceURL comment to identify scritps that don't |
444 * have name. | 444 * have name. |
445 * | 445 * |
446 * @return {?string} script name if present, value for //@ sourceURL comment | 446 * @return {?string} script name if present, value for //@ sourceURL comment |
447 * otherwise. | 447 * otherwise. |
448 */ | 448 */ |
449 Script.prototype.nameOrSourceURL = function() { | 449 Script.prototype.nameOrSourceURL = function() { |
450 if (this.name) | 450 if (this.name) |
451 return this.name; | 451 return this.name; |
452 // TODO(608): the spaces in a regexp below had to be escaped as \040 | 452 // TODO(608): the spaces in a regexp below had to be escaped as \040 |
453 // because this file is being processed by js2c whose handling of spaces | 453 // because this file is being processed by js2c whose handling of spaces |
454 // in regexps is broken. Also, ['"] are excluded from allowed URLs to | 454 // in regexps is broken. Also, ['"] are excluded from allowed URLs to |
455 // avoid matches against sources that invoke evals with sourceURL. | 455 // avoid matches against sources that invoke evals with sourceURL. |
456 var sourceUrlPattern = | 456 var sourceUrlPattern = |
457 /\/\/@[\040\t]sourceURL=[\040\t]*([^\s'"]*)[\040\t]*$/m; | 457 /\/\/@[\040\t]sourceURL=[\040\t]*([^\s'"]*)[\040\t]*$/m; |
458 var match = sourceUrlPattern.exec(this.source); | 458 var match = sourceUrlPattern.exec(this.source); |
459 return match ? match[1] : this.name; | 459 return match ? match[1] : this.name; |
460 } | 460 } |
461 | 461 |
462 | 462 |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); | 993 return this.name + ": " + FormatMessage({ type: type, args: this.arguments }
); |
994 } | 994 } |
995 var message = this.message; | 995 var message = this.message; |
996 return this.name + (message ? (": " + message) : ""); | 996 return this.name + (message ? (": " + message) : ""); |
997 }, DONT_ENUM); | 997 }, DONT_ENUM); |
998 | 998 |
999 | 999 |
1000 // Boilerplate for exceptions for stack overflows. Used from | 1000 // Boilerplate for exceptions for stack overflows. Used from |
1001 // Top::StackOverflow(). | 1001 // Top::StackOverflow(). |
1002 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 1002 const kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
OLD | NEW |