OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 // Flags: --expose-debug-as debug --allow-natives-syntax --noanalyze-environment -liveness | 28 // Flags: --noanalyze-environment-liveness |
29 // The functions used for testing backtraces. They are at the top to make the | 29 // The functions used for testing backtraces. They are at the top to make the |
30 // testing of source line/column easier. | 30 // testing of source line/column easier. |
31 | 31 |
32 // Get the Debug object exposed from the debug context global object. | |
33 var Debug = debug.Debug; | 32 var Debug = debug.Debug; |
34 | 33 |
35 var test_name; | 34 var test_name; |
36 var listener_delegate; | 35 var listener_delegate; |
37 var listener_called; | 36 var listener_called; |
38 var exception; | 37 var exception; |
39 var begin_test_count = 0; | 38 var begin_test_count = 0; |
40 var end_test_count = 0; | 39 var end_test_count = 0; |
41 var break_count = 0; | 40 var break_count = 0; |
41 var global_marker = 7; | |
42 | 42 |
43 | 43 |
44 // Debug event listener which delegates. | 44 // Debug event listener which delegates. |
45 function listener(event, exec_state, event_data, data) { | 45 function listener(event, exec_state, event_data, data) { |
46 try { | 46 try { |
47 if (event == Debug.DebugEvent.Break) { | 47 if (event == Debug.DebugEvent.Break) { |
48 break_count++; | 48 break_count++; |
49 listener_called = true; | 49 listener_called = true; |
50 listener_delegate(exec_state); | 50 listener_delegate(exec_state); |
51 } | 51 } |
52 } catch (e) { | 52 } catch (e) { |
53 exception = e; | 53 exception = e; |
54 print(e, e.stack); | |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
57 // Add the debug event listener. | 58 // Add the debug event listener. |
58 Debug.setListener(listener); | 59 Debug.setListener(listener); |
59 | 60 |
60 | 61 |
61 // Initialize for a new test. | 62 // Initialize for a new test. |
62 function BeginTest(name) { | 63 function BeginTest(name) { |
63 test_name = name; | 64 test_name = name; |
64 listener_delegate = null; | 65 listener_delegate = null; |
65 listener_called = false; | 66 listener_called = false; |
66 exception = null; | 67 exception = null; |
67 begin_test_count++; | 68 begin_test_count++; |
68 } | 69 } |
69 | 70 |
70 | 71 |
71 // Check result of a test. | 72 // Check result of a test. |
72 function EndTest() { | 73 function EndTest() { |
73 assertTrue(listener_called, "listerner not called for " + test_name); | 74 assertTrue(listener_called, "listener not called for " + test_name); |
74 assertNull(exception, test_name + " / " + exception); | 75 assertNull(exception, test_name + " / " + exception); |
75 end_test_count++; | 76 end_test_count++; |
76 } | 77 } |
77 | 78 |
78 | 79 |
79 // Check that two scope are the same. | 80 // Check that two scope are the same. |
80 function assertScopeMirrorEquals(scope1, scope2) { | 81 function assertScopeMirrorEquals(scope1, scope2) { |
81 assertEquals(scope1.scopeType(), scope2.scopeType()); | 82 assertEquals(scope1.scopeType(), scope2.scopeType()); |
82 assertEquals(scope1.frameIndex(), scope2.frameIndex()); | 83 assertEquals(scope1.frameIndex(), scope2.frameIndex()); |
83 assertEquals(scope1.scopeIndex(), scope2.scopeIndex()); | 84 assertEquals(scope1.scopeIndex(), scope2.scopeIndex()); |
84 assertPropertiesEqual(scope1.scopeObject().value(), scope2.scopeObject().value ()); | 85 assertPropertiesEqual(scope1.scopeObject().value(), scope2.scopeObject().value ()); |
85 } | 86 } |
86 | 87 |
87 function CheckFastAllScopes(scopes, exec_state) | 88 function CheckFastAllScopes(scopes, exec_state) |
88 { | 89 { |
89 var fast_all_scopes = exec_state.frame().allScopes(true); | 90 var fast_all_scopes = exec_state.frame().allScopes(true); |
90 var length = fast_all_scopes.length; | 91 var length = fast_all_scopes.length; |
91 assertTrue(scopes.length >= length); | 92 assertTrue(scopes.length >= length); |
92 for (var i = 0; i < scopes.length && i < length; i++) { | 93 for (var i = 0; i < scopes.length && i < length; i++) { |
93 var scope = fast_all_scopes[length - i - 1]; | 94 var scope = fast_all_scopes[length - i - 1]; |
94 assertTrue(scope.isScope()); | |
95 assertEquals(scopes[scopes.length - i - 1], scope.scopeType()); | 95 assertEquals(scopes[scopes.length - i - 1], scope.scopeType()); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 // Check that the scope chain contains the expected types of scopes. | 100 // Check that the scope chain contains the expected types of scopes. |
101 function CheckScopeChain(scopes, exec_state) { | 101 function CheckScopeChain(scopes, exec_state) { |
102 var all_scopes = exec_state.frame().allScopes(); | 102 var all_scopes = exec_state.frame().allScopes(); |
103 assertEquals(scopes.length, exec_state.frame().scopeCount()); | 103 assertEquals(scopes.length, exec_state.frame().scopeCount()); |
104 assertEquals(scopes.length, all_scopes.length, "FrameMirror.allScopes length") ; | 104 assertEquals(scopes.length, all_scopes.length, "FrameMirror.allScopes length") ; |
105 for (var i = 0; i < scopes.length; i++) { | 105 for (var i = 0; i < scopes.length; i++) { |
106 var scope = exec_state.frame().scope(i); | 106 var scope = exec_state.frame().scope(i); |
107 assertTrue(scope.isScope()); | |
108 assertEquals(scopes[i], scope.scopeType()); | 107 assertEquals(scopes[i], scope.scopeType()); |
109 assertScopeMirrorEquals(all_scopes[i], scope); | 108 assertScopeMirrorEquals(all_scopes[i], scope); |
110 | 109 |
111 // Check the global object when hitting the global scope. | 110 // Check the global object when hitting the global scope. |
112 if (scopes[i] == debug.ScopeType.Global) { | 111 if (scopes[i] == debug.ScopeType.Global) { |
113 // Objects don't have same class (one is "global", other is "Object", | 112 // Just check the marker of the global object. |
114 // so just check the properties directly. | 113 assertEquals(scope.scopeObject().value().global_marker, global_marker); |
115 assertPropertiesEqual(this, scope.scopeObject().value()); | |
116 } | 114 } |
117 } | 115 } |
118 CheckFastAllScopes(scopes, exec_state); | 116 CheckFastAllScopes(scopes, exec_state); |
119 } | 117 } |
120 | 118 |
121 | 119 |
122 // Check that the scope chain contains the expected names of scopes. | 120 // Check that the scope chain contains the expected names of scopes. |
123 function CheckScopeChainNames(names, exec_state) { | 121 function CheckScopeChainNames(names, exec_state) { |
124 var all_scopes = exec_state.frame().allScopes(); | 122 var all_scopes = exec_state.frame().allScopes(); |
125 assertEquals(names.length, all_scopes.length, "FrameMirror.allScopes length"); | 123 assertEquals(names.length, all_scopes.length, "FrameMirror.allScopes length"); |
126 for (var i = 0; i < names.length; i++) { | 124 for (var i = 0; i < names.length; i++) { |
127 var scope = exec_state.frame().scope(i); | 125 var scope = exec_state.frame().scope(i); |
128 assertTrue(scope.isScope()); | |
129 assertEquals(names[i], scope.details().name()) | 126 assertEquals(names[i], scope.details().name()) |
130 } | 127 } |
131 } | 128 } |
132 | 129 |
133 | 130 |
134 // Check that the scope contains at least minimum_content. For functions just | 131 // Check that the scope contains at least minimum_content. For functions just |
135 // check that there is a function. | 132 // check that there is a function. |
136 function CheckScopeContent(minimum_content, number, exec_state) { | 133 function CheckScopeContent(minimum_content, number, exec_state) { |
137 var scope = exec_state.frame().scope(number); | 134 var scope = exec_state.frame().scope(number); |
138 var minimum_count = 0; | 135 var minimum_count = 0; |
139 for (var p in minimum_content) { | 136 for (var p in minimum_content) { |
140 var property_mirror = scope.scopeObject().property(p); | 137 var property_mirror = scope.scopeObject().property(p); |
141 assertFalse(property_mirror.isUndefined(), | 138 assertFalse(property_mirror.isUndefined(), |
142 'property ' + p + ' not found in scope'); | 139 'property ' + p + ' not found in scope'); |
143 if (typeof(minimum_content[p]) === 'function') { | 140 if (typeof(minimum_content[p]) === 'function') { |
jgruber
2016/12/12 13:11:57
We can remove the function branch as in the other
| |
144 assertTrue(property_mirror.value().isFunction()); | 141 print(property_mirror.value().value()); |
142 assertTrue(property_mirror.value() instanceof Function); | |
145 } else { | 143 } else { |
146 assertEquals(minimum_content[p], property_mirror.value().value(), | 144 assertEquals(minimum_content[p], property_mirror.value().value(), |
147 'property ' + p + ' has unexpected value'); | 145 'property ' + p + ' has unexpected value'); |
148 } | 146 } |
149 minimum_count++; | 147 minimum_count++; |
150 } | 148 } |
151 | 149 |
152 // 'arguments' and might be exposed in the local and closure scope. Just | 150 // 'arguments' and might be exposed in the local and closure scope. Just |
153 // ignore this. | 151 // ignore this. |
154 var scope_size = scope.scopeObject().properties().length; | 152 var scope_size = scope.scopeObject().properties().length; |
(...skipping 16 matching lines...) Expand all Loading... | |
171 } | 169 } |
172 assertTrue(scope_size >= minimum_count); | 170 assertTrue(scope_size >= minimum_count); |
173 } | 171 } |
174 | 172 |
175 // Check that the scopes have positions as expected. | 173 // Check that the scopes have positions as expected. |
176 function CheckScopeChainPositions(positions, exec_state) { | 174 function CheckScopeChainPositions(positions, exec_state) { |
177 var all_scopes = exec_state.frame().allScopes(); | 175 var all_scopes = exec_state.frame().allScopes(); |
178 assertEquals(positions.length, all_scopes.length, "FrameMirror.allScopes lengt h"); | 176 assertEquals(positions.length, all_scopes.length, "FrameMirror.allScopes lengt h"); |
179 for (var i = 0; i < positions.length; i++) { | 177 for (var i = 0; i < positions.length; i++) { |
180 var scope = exec_state.frame().scope(i); | 178 var scope = exec_state.frame().scope(i); |
181 assertTrue(scope.isScope()); | |
182 var position = positions[i]; | 179 var position = positions[i]; |
183 if (!position) | 180 if (!position) |
184 continue; | 181 continue; |
185 | 182 |
186 assertEquals(position.start, scope.details().startPosition()) | 183 assertEquals(position.start, scope.details().startPosition()) |
187 assertEquals(position.end, scope.details().endPosition()) | 184 assertEquals(position.end, scope.details().endPosition()) |
188 } | 185 } |
189 } | 186 } |
190 | 187 |
191 // Simple empty local scope. | 188 // Simple empty local scope. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 } | 415 } |
419 | 416 |
420 listener_delegate = function(exec_state) { | 417 listener_delegate = function(exec_state) { |
421 CheckScopeChain([debug.ScopeType.With, | 418 CheckScopeChain([debug.ScopeType.With, |
422 debug.ScopeType.With, | 419 debug.ScopeType.With, |
423 debug.ScopeType.Local, | 420 debug.ScopeType.Local, |
424 debug.ScopeType.Script, | 421 debug.ScopeType.Script, |
425 debug.ScopeType.Global], exec_state); | 422 debug.ScopeType.Global], exec_state); |
426 CheckScopeContent(with_object, 0, exec_state); | 423 CheckScopeContent(with_object, 0, exec_state); |
427 CheckScopeContent(with_object, 1, exec_state); | 424 CheckScopeContent(with_object, 1, exec_state); |
428 assertEquals(exec_state.frame().scope(0).scopeObject(), | 425 assertEquals(exec_state.frame().scope(0).scopeObject().value(), |
429 exec_state.frame().scope(1).scopeObject()); | 426 exec_state.frame().scope(1).scopeObject().value()); |
430 assertEquals(with_object, exec_state.frame().scope(1).scopeObject().value()); | 427 assertEquals(with_object, exec_state.frame().scope(1).scopeObject().value()); |
431 }; | 428 }; |
432 with_5(); | 429 with_5(); |
433 EndTest(); | 430 EndTest(); |
434 | 431 |
435 | 432 |
436 // Nested with blocks using existing object in global code. | 433 // Nested with blocks using existing object in global code. |
437 BeginTest("With 6"); | 434 BeginTest("With 6"); |
438 listener_delegate = function(exec_state) { | 435 listener_delegate = function(exec_state) { |
439 CheckScopeChain([debug.ScopeType.With, | 436 CheckScopeChain([debug.ScopeType.With, |
440 debug.ScopeType.With, | 437 debug.ScopeType.With, |
441 debug.ScopeType.Script, | 438 debug.ScopeType.Script, |
442 debug.ScopeType.Global], exec_state); | 439 debug.ScopeType.Global], exec_state); |
443 CheckScopeContent(with_object, 0, exec_state); | 440 CheckScopeContent(with_object, 0, exec_state); |
444 CheckScopeContent(with_object, 1, exec_state); | 441 CheckScopeContent(with_object, 1, exec_state); |
445 assertEquals(exec_state.frame().scope(0).scopeObject(), | 442 assertEquals(exec_state.frame().scope(0).scopeObject().value(), |
446 exec_state.frame().scope(1).scopeObject()); | 443 exec_state.frame().scope(1).scopeObject().value()); |
447 assertEquals(with_object, exec_state.frame().scope(1).scopeObject().value()); | 444 assertEquals(with_object, exec_state.frame().scope(1).scopeObject().value()); |
448 }; | 445 }; |
449 | 446 |
450 var with_object = {c:3,d:4}; | 447 var with_object = {c:3,d:4}; |
451 with(with_object) { | 448 with(with_object) { |
452 with(with_object) { | 449 with(with_object) { |
453 debugger; | 450 debugger; |
454 } | 451 } |
455 } | 452 } |
456 EndTest(); | 453 EndTest(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 } | 570 } |
574 }; | 571 }; |
575 return f; | 572 return f; |
576 } | 573 } |
577 | 574 |
578 listener_delegate = function(exec_state) { | 575 listener_delegate = function(exec_state) { |
579 CheckScopeChain([debug.ScopeType.Local, | 576 CheckScopeChain([debug.ScopeType.Local, |
580 debug.ScopeType.Closure, | 577 debug.ScopeType.Closure, |
581 debug.ScopeType.Script, | 578 debug.ScopeType.Script, |
582 debug.ScopeType.Global], exec_state); | 579 debug.ScopeType.Global], exec_state); |
583 CheckScopeContent({a:1,b:2,x:3,y:4,f:function(){}}, 1, exec_state); | 580 CheckScopeContent({a:1,b:2,x:3,y:4,f:undefined}, 1, exec_state); |
584 CheckScopeChainNames(["f", "closure_4", undefined, undefined], exec_state); | 581 CheckScopeChainNames(["f", "closure_4", undefined, undefined], exec_state); |
585 }; | 582 }; |
586 closure_4(1, 2)(); | 583 closure_4(1, 2)(); |
587 EndTest(); | 584 EndTest(); |
588 | 585 |
589 | 586 |
590 | 587 |
591 // Simple closure formed by returning an inner function referering the outer | 588 // Simple closure formed by returning an inner function referering the outer |
592 // functions arguments. In the presence of eval all arguments and locals | 589 // functions arguments. In the presence of eval all arguments and locals |
593 // (including the inner function itself) from the outer function becomes part of | 590 // (including the inner function itself) from the outer function becomes part of |
594 // the debugger infformation on the closure. | 591 // the debugger infformation on the closure. |
595 BeginTest("Closure 5"); | 592 BeginTest("Closure 5"); |
596 | 593 |
597 function closure_5(a, b) { | 594 function closure_5(a, b) { |
598 var x = 3; | 595 var x = 3; |
599 var y = 4; | 596 var y = 4; |
600 function f() { | 597 function f() { |
601 eval(''); | 598 eval(''); |
602 debugger; | 599 debugger; |
603 return 1; | 600 return 1; |
604 }; | 601 }; |
605 return f; | 602 return f; |
606 } | 603 } |
607 | 604 |
608 listener_delegate = function(exec_state) { | 605 listener_delegate = function(exec_state) { |
609 CheckScopeChain([debug.ScopeType.Local, | 606 CheckScopeChain([debug.ScopeType.Local, |
610 debug.ScopeType.Closure, | 607 debug.ScopeType.Closure, |
611 debug.ScopeType.Script, | 608 debug.ScopeType.Script, |
612 debug.ScopeType.Global], exec_state); | 609 debug.ScopeType.Global], exec_state); |
613 CheckScopeContent({a:1,b:2,x:3,y:4,f:function(){}}, 1, exec_state); | 610 CheckScopeContent({a:1,b:2,x:3,y:4,f:undefined}, 1, exec_state); |
614 CheckScopeChainNames(["f", "closure_5", undefined, undefined], exec_state) | 611 CheckScopeChainNames(["f", "closure_5", undefined, undefined], exec_state) |
615 }; | 612 }; |
616 closure_5(1, 2)(); | 613 closure_5(1, 2)(); |
617 EndTest(); | 614 EndTest(); |
618 | 615 |
619 | 616 |
620 // Two closures. Due to optimizations only the parts actually used are provided | 617 // Two closures. Due to optimizations only the parts actually used are provided |
621 // through the debugger information. | 618 // through the debugger information. |
622 BeginTest("Closure 6"); | 619 BeginTest("Closure 6"); |
623 function closure_6(a, b) { | 620 function closure_6(a, b) { |
(...skipping 11 matching lines...) Expand all Loading... | |
635 return f(a, b); | 632 return f(a, b); |
636 } | 633 } |
637 | 634 |
638 listener_delegate = function(exec_state) { | 635 listener_delegate = function(exec_state) { |
639 CheckScopeChain([debug.ScopeType.Local, | 636 CheckScopeChain([debug.ScopeType.Local, |
640 debug.ScopeType.Closure, | 637 debug.ScopeType.Closure, |
641 debug.ScopeType.Closure, | 638 debug.ScopeType.Closure, |
642 debug.ScopeType.Script, | 639 debug.ScopeType.Script, |
643 debug.ScopeType.Global], exec_state); | 640 debug.ScopeType.Global], exec_state); |
644 CheckScopeContent({a:1}, 1, exec_state); | 641 CheckScopeContent({a:1}, 1, exec_state); |
645 CheckScopeContent({f:function(){}}, 2, exec_state); | 642 CheckScopeContent({f:undefined}, 2, exec_state); |
646 CheckScopeChainNames([undefined, "f", "closure_6", undefined, undefined], | 643 CheckScopeChainNames([undefined, "f", "closure_6", undefined, undefined], |
647 exec_state); | 644 exec_state); |
648 }; | 645 }; |
649 closure_6(1, 2)(); | 646 closure_6(1, 2)(); |
650 EndTest(); | 647 EndTest(); |
651 | 648 |
652 | 649 |
653 // Two closures. In the presence of eval all information is provided as the | 650 // Two closures. In the presence of eval all information is provided as the |
654 // compiler cannot determine which parts are used. | 651 // compiler cannot determine which parts are used. |
655 BeginTest("Closure 7"); | 652 BeginTest("Closure 7"); |
(...skipping 17 matching lines...) Expand all Loading... | |
673 } | 670 } |
674 | 671 |
675 listener_delegate = function(exec_state) { | 672 listener_delegate = function(exec_state) { |
676 CheckScopeChain([debug.ScopeType.Local, | 673 CheckScopeChain([debug.ScopeType.Local, |
677 debug.ScopeType.Closure, | 674 debug.ScopeType.Closure, |
678 debug.ScopeType.Closure, | 675 debug.ScopeType.Closure, |
679 debug.ScopeType.Script, | 676 debug.ScopeType.Script, |
680 debug.ScopeType.Global], exec_state); | 677 debug.ScopeType.Global], exec_state); |
681 CheckScopeContent({}, 0, exec_state); | 678 CheckScopeContent({}, 0, exec_state); |
682 CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6}, 1, exec_state); | 679 CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6}, 1, exec_state); |
683 CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:function(){}}, 2, exec_state); | 680 CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:undefined}, 2, exec_state); |
684 CheckScopeChainNames([undefined, "f", "closure_7", undefined, undefined], | 681 CheckScopeChainNames([undefined, "f", "closure_7", undefined, undefined], |
685 exec_state); | 682 exec_state); |
686 }; | 683 }; |
687 closure_7(1, 2)(); | 684 closure_7(1, 2)(); |
688 EndTest(); | 685 EndTest(); |
689 | 686 |
690 | 687 |
691 // Closure that may be optimized out. | 688 // Closure that may be optimized out. |
692 BeginTest("Closure 8"); | 689 BeginTest("Closure 8"); |
693 function closure_8() { | 690 function closure_8() { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
765 debug.ScopeType.With, | 762 debug.ScopeType.With, |
766 debug.ScopeType.Closure, | 763 debug.ScopeType.Closure, |
767 debug.ScopeType.Closure, | 764 debug.ScopeType.Closure, |
768 debug.ScopeType.Script, | 765 debug.ScopeType.Script, |
769 debug.ScopeType.Global], exec_state); | 766 debug.ScopeType.Global], exec_state); |
770 CheckScopeContent({b:16}, 0, exec_state); | 767 CheckScopeContent({b:16}, 0, exec_state); |
771 CheckScopeContent({a:15}, 1, exec_state); | 768 CheckScopeContent({a:15}, 1, exec_state); |
772 CheckScopeContent({x:14}, 2, exec_state); | 769 CheckScopeContent({x:14}, 2, exec_state); |
773 CheckScopeContent({j:13}, 3, exec_state); | 770 CheckScopeContent({j:13}, 3, exec_state); |
774 CheckScopeContent({a:1,b:2,x:9,y:10,i:11,j:12}, 4, exec_state); | 771 CheckScopeContent({a:1,b:2,x:9,y:10,i:11,j:12}, 4, exec_state); |
775 CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:function(){}}, 5, exec_state); | 772 CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:undefined}, 5, exec_state); |
776 CheckScopeChainNames([undefined, undefined, undefined, "f", "f", | 773 CheckScopeChainNames([undefined, undefined, undefined, "f", "f", |
777 "the_full_monty", undefined, undefined], exec_state); | 774 "the_full_monty", undefined, undefined], exec_state); |
778 }; | 775 }; |
779 the_full_monty(1, 2)(); | 776 the_full_monty(1, 2)(); |
780 EndTest(); | 777 EndTest(); |
781 | 778 |
782 | 779 |
783 BeginTest("Closure inside With 1"); | 780 BeginTest("Closure inside With 1"); |
784 function closure_in_with_1() { | 781 function closure_in_with_1() { |
785 with({x:1}) { | 782 with({x:1}) { |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1259 CheckScopeChainPositions( | 1256 CheckScopeChainPositions( |
1260 [{start: 89, end: 183}, {start: 27, end: 217}, {}, {}], exec_state); | 1257 [{start: 89, end: 183}, {start: 27, end: 217}, {}, {}], exec_state); |
1261 } | 1258 } |
1262 eval(code8); | 1259 eval(code8); |
1263 EndTest(); | 1260 EndTest(); |
1264 | 1261 |
1265 assertEquals(begin_test_count, break_count, | 1262 assertEquals(begin_test_count, break_count, |
1266 'one or more tests did not enter the debugger'); | 1263 'one or more tests did not enter the debugger'); |
1267 assertEquals(begin_test_count, end_test_count, | 1264 assertEquals(begin_test_count, end_test_count, |
1268 'one or more tests did not have its result checked'); | 1265 'one or more tests did not have its result checked'); |
OLD | NEW |