OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
6 | 6 |
7 var kMessages = { | 7 var kMessages = { |
8 // Error | 8 // Error |
9 cyclic_proto: ["Cyclic __proto__ value"], | 9 cyclic_proto: ["Cyclic __proto__ value"], |
10 code_gen_from_strings: ["%0"], | 10 code_gen_from_strings: ["%0"], |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 * @return {number} | 582 * @return {number} |
583 * Number of source lines. | 583 * Number of source lines. |
584 */ | 584 */ |
585 function ScriptLineCount() { | 585 function ScriptLineCount() { |
586 // Return number of source lines. | 586 // Return number of source lines. |
587 return this.line_ends.length; | 587 return this.line_ends.length; |
588 } | 588 } |
589 | 589 |
590 | 590 |
591 /** | 591 /** |
592 * If sourceURL comment is available and script starts at zero returns sourceURL | 592 * If sourceURL comment is available returns sourceURL comment contents. |
593 * comment contents. Otherwise, script name is returned. See | 593 * Otherwise, script name is returned. See |
594 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt | 594 * http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt |
595 * and Source Map Revision 3 proposal for details on using //# sourceURL and | 595 * and Source Map Revision 3 proposal for details on using //# sourceURL and |
596 * deprecated //@ sourceURL comment to identify scripts that don't have name. | 596 * deprecated //@ sourceURL comment to identify scripts that don't have name. |
597 * | 597 * |
598 * @return {?string} script name if present, value for //# sourceURL or | 598 * @return {?string} script name if present, value for //# sourceURL or |
599 * deprecated //@ sourceURL comment otherwise. | 599 * deprecated //@ sourceURL comment otherwise. |
600 */ | 600 */ |
601 function ScriptNameOrSourceURL() { | 601 function ScriptNameOrSourceURL() { |
602 if (this.line_offset > 0 || this.column_offset > 0) { | 602 if (this.source_url) return this.source_url; |
603 return this.name; | |
604 } | |
605 if (this.source_url) { | |
606 return this.source_url; | |
607 } | |
608 return this.name; | 603 return this.name; |
609 } | 604 } |
610 | 605 |
611 | 606 |
612 SetUpLockedPrototype(Script, | 607 SetUpLockedPrototype(Script, |
613 $Array("source", "name", "source_url", "source_mapping_url", "line_ends", | 608 $Array("source", "name", "source_url", "source_mapping_url", "line_ends", |
614 "line_offset", "column_offset"), | 609 "line_offset", "column_offset"), |
615 $Array( | 610 $Array( |
616 "lineFromPosition", ScriptLineFromPosition, | 611 "lineFromPosition", ScriptLineFromPosition, |
617 "locationFromPosition", ScriptLocationFromPosition, | 612 "locationFromPosition", ScriptLocationFromPosition, |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 function SetUpStackOverflowBoilerplate() { | 1323 function SetUpStackOverflowBoilerplate() { |
1329 var boilerplate = MakeRangeError('stack_overflow', []); | 1324 var boilerplate = MakeRangeError('stack_overflow', []); |
1330 | 1325 |
1331 %DefineAccessorPropertyUnchecked( | 1326 %DefineAccessorPropertyUnchecked( |
1332 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1327 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1333 | 1328 |
1334 return boilerplate; | 1329 return boilerplate; |
1335 } | 1330 } |
1336 | 1331 |
1337 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1332 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |