OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 count++; | 134 count++; |
135 } | 135 } |
136 | 136 |
137 // 'arguments' and might be exposed in the local and closure scope. Just | 137 // 'arguments' and might be exposed in the local and closure scope. Just |
138 // ignore this. | 138 // ignore this. |
139 var scope_size = scope.scopeObject().properties().length; | 139 var scope_size = scope.scopeObject().properties().length; |
140 if (!scope.scopeObject().property('arguments').isUndefined()) { | 140 if (!scope.scopeObject().property('arguments').isUndefined()) { |
141 scope_size--; | 141 scope_size--; |
142 } | 142 } |
| 143 // Also ignore synthetic variable from catch block. |
| 144 if (!scope.scopeObject().property('.catch-var').isUndefined()) { |
| 145 scope_size--; |
| 146 } |
| 147 |
143 if (count != scope_size) { | 148 if (count != scope_size) { |
144 print('Names found in scope:'); | 149 print('Names found in scope:'); |
145 var names = scope.scopeObject().propertyNames(); | 150 var names = scope.scopeObject().propertyNames(); |
146 for (var i = 0; i < names.length; i++) { | 151 for (var i = 0; i < names.length; i++) { |
147 print(names[i]); | 152 print(names[i]); |
148 } | 153 } |
149 } | 154 } |
150 assertEquals(count, scope_size); | 155 assertEquals(count, scope_size); |
151 | 156 |
152 // Get the debug command processor. | 157 // Get the debug command processor. |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 EndTest(); | 654 EndTest(); |
650 | 655 |
651 // Test global scope. | 656 // Test global scope. |
652 BeginTest("Global"); | 657 BeginTest("Global"); |
653 listener_delegate = function(exec_state) { | 658 listener_delegate = function(exec_state) { |
654 CheckScopeChain([debug.ScopeType.Global], exec_state); | 659 CheckScopeChain([debug.ScopeType.Global], exec_state); |
655 } | 660 } |
656 debugger; | 661 debugger; |
657 EndTest(); | 662 EndTest(); |
658 | 663 |
| 664 |
| 665 BeginTest("Catch block 1"); |
| 666 function catch_block_1() { |
| 667 try { |
| 668 throw 'Exception'; |
| 669 } catch (e) { |
| 670 debugger; |
| 671 } |
| 672 }; |
| 673 |
| 674 |
| 675 listener_delegate = function(exec_state) { |
| 676 CheckScopeChain([debug.ScopeType.Catch, |
| 677 debug.ScopeType.Local, |
| 678 debug.ScopeType.Global], exec_state); |
| 679 CheckScopeContent({e:'Exception'}, 0, exec_state); |
| 680 } |
| 681 catch_block_1() |
| 682 EndTest(); |
| 683 |
| 684 |
| 685 BeginTest("Catch block 2"); |
| 686 function catch_block_2() { |
| 687 try { |
| 688 throw 'Exception'; |
| 689 } catch (e) { |
| 690 with({n:10}) { |
| 691 debugger; |
| 692 } |
| 693 } |
| 694 }; |
| 695 |
| 696 |
| 697 listener_delegate = function(exec_state) { |
| 698 CheckScopeChain([debug.ScopeType.With, |
| 699 debug.ScopeType.Catch, |
| 700 debug.ScopeType.Local, |
| 701 debug.ScopeType.Global], exec_state); |
| 702 CheckScopeContent({n:10}, 0, exec_state); |
| 703 CheckScopeContent({e:'Exception'}, 1, exec_state); |
| 704 } |
| 705 catch_block_2() |
| 706 EndTest(); |
| 707 |
| 708 |
| 709 BeginTest("Catch block 3"); |
| 710 function catch_block_1() { |
| 711 // Do eval to dynamically declare a local variable so that the context's |
| 712 // extension slot is initialized with JSContextExtensionObject. |
| 713 eval("var y = 78;"); |
| 714 try { |
| 715 throw 'Exception'; |
| 716 } catch (e) { |
| 717 debugger; |
| 718 } |
| 719 }; |
| 720 |
| 721 |
| 722 listener_delegate = function(exec_state) { |
| 723 CheckScopeChain([debug.ScopeType.Catch, |
| 724 debug.ScopeType.Local, |
| 725 debug.ScopeType.Global], exec_state); |
| 726 CheckScopeContent({e:'Exception'}, 0, exec_state); |
| 727 CheckScopeContent({y:78}, 1, exec_state); |
| 728 } |
| 729 catch_block_1() |
| 730 EndTest(); |
| 731 |
| 732 |
| 733 BeginTest("Catch block 4"); |
| 734 function catch_block_2() { |
| 735 // Do eval to dynamically declare a local variable so that the context's |
| 736 // extension slot is initialized with JSContextExtensionObject. |
| 737 eval("var y = 98;"); |
| 738 try { |
| 739 throw 'Exception'; |
| 740 } catch (e) { |
| 741 with({n:10}) { |
| 742 debugger; |
| 743 } |
| 744 } |
| 745 }; |
| 746 |
| 747 listener_delegate = function(exec_state) { |
| 748 CheckScopeChain([debug.ScopeType.With, |
| 749 debug.ScopeType.Catch, |
| 750 debug.ScopeType.Local, |
| 751 debug.ScopeType.Global], exec_state); |
| 752 CheckScopeContent({n:10}, 0, exec_state); |
| 753 CheckScopeContent({e:'Exception'}, 1, exec_state); |
| 754 CheckScopeContent({y:98}, 2, exec_state); |
| 755 } |
| 756 catch_block_2() |
| 757 EndTest(); |
| 758 |
| 759 |
659 assertEquals(begin_test_count, break_count, 'one or more tests did not enter the
debugger'); | 760 assertEquals(begin_test_count, break_count, 'one or more tests did not enter the
debugger'); |
660 assertEquals(begin_test_count, end_test_count, 'one or more tests did not have i
ts result checked'); | 761 assertEquals(begin_test_count, end_test_count, 'one or more tests did not have i
ts result checked'); |
OLD | NEW |