OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 assertPropertiesEqual(expected_locals, locals); | 82 assertPropertiesEqual(expected_locals, locals); |
83 | 83 |
84 // All frames except the bottom one have expected arguments. | 84 // All frames except the bottom one have expected arguments. |
85 for (var j = 0; j < expected_args.names.length; j++) { | 85 for (var j = 0; j < expected_args.names.length; j++) { |
86 assertEquals(expected_args.names[j], frame.argumentName(j)); | 86 assertEquals(expected_args.names[j], frame.argumentName(j)); |
87 assertEquals(expected_args.values[j], | 87 assertEquals(expected_args.values[j], |
88 frame.argumentValue(j).value()); | 88 frame.argumentValue(j).value()); |
89 } | 89 } |
90 | 90 |
91 // All frames except the bottom one have two scopes. | 91 // All frames except the bottom one have two scopes. |
92 assertEquals(2, frame.scopeCount()); | 92 assertEquals(3, frame.scopeCount()); |
93 assertEquals(debug.ScopeType.Local, frame.scope(0).scopeType()); | 93 assertEquals(debug.ScopeType.Local, frame.scope(0).scopeType()); |
94 assertEquals(debug.ScopeType.Global, frame.scope(1).scopeType()); | 94 assertEquals(debug.ScopeType.Script, frame.scope(1).scopeType()); |
| 95 assertEquals(debug.ScopeType.Global, frame.scope(2).scopeType()); |
95 | 96 |
96 Object.keys(expected_locals).forEach(function (name) { | 97 Object.keys(expected_locals).forEach(function (name) { |
97 assertEquals(expected_locals[name], | 98 assertEquals(expected_locals[name], |
98 frame.scope(0).scopeObject().value()[name]); | 99 frame.scope(0).scopeObject().value()[name]); |
99 }); | 100 }); |
100 | 101 |
101 for (var j = 0; j < expected_args.names.length; j++) { | 102 for (var j = 0; j < expected_args.names.length; j++) { |
102 var arg_name = expected_args.names[j]; | 103 var arg_name = expected_args.names[j]; |
103 var arg_value = expected_args.values[j]; | 104 var arg_value = expected_args.values[j]; |
104 assertEquals(arg_value, | 105 assertEquals(arg_value, |
(...skipping 22 matching lines...) Expand all Loading... |
127 ' + ' + | 128 ' + ' + |
128 expected_args.names.join('+')).value()); | 129 expected_args.names.join('+')).value()); |
129 | 130 |
130 var arguments_sum = expected_args.names.map(function(_, idx) { | 131 var arguments_sum = expected_args.names.map(function(_, idx) { |
131 return "arguments[" + idx + "]"; | 132 return "arguments[" + idx + "]"; |
132 }).join('+'); | 133 }).join('+'); |
133 assertEquals(expected_args_sum, | 134 assertEquals(expected_args_sum, |
134 frame.evaluate(arguments_sum).value()); | 135 frame.evaluate(arguments_sum).value()); |
135 } else { | 136 } else { |
136 // The bottom frame only have the global scope. | 137 // The bottom frame only have the global scope. |
137 assertEquals(1, frame.scopeCount()); | 138 assertEquals(2, frame.scopeCount()); |
138 assertEquals(debug.ScopeType.Global, frame.scope(0).scopeType()); | 139 assertEquals(debug.ScopeType.Script, frame.scope(0).scopeType()); |
| 140 assertEquals(debug.ScopeType.Global, frame.scope(1).scopeType()); |
139 } | 141 } |
140 | 142 |
141 // Check the frame function. | 143 // Check the frame function. |
142 switch (i) { | 144 switch (i) { |
143 case 0: assertEquals(h, frame.func().value()); break; | 145 case 0: assertEquals(h, frame.func().value()); break; |
144 case 1: assertEquals(g3, frame.func().value()); break; | 146 case 1: assertEquals(g3, frame.func().value()); break; |
145 case 2: assertEquals(g2, frame.func().value()); break; | 147 case 2: assertEquals(g2, frame.func().value()); break; |
146 case 3: assertEquals(g1, frame.func().value()); break; | 148 case 3: assertEquals(g1, frame.func().value()); break; |
147 case 4: assertEquals(f, frame.func().value()); break; | 149 case 4: assertEquals(f, frame.func().value()); break; |
148 case 5: break; | 150 case 5: break; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 new f(input.length - 1, 11.11, 12.12, ""); | 234 new f(input.length - 1, 11.11, 12.12, ""); |
233 | 235 |
234 // Make sure that the debug event listener was invoked. | 236 // Make sure that the debug event listener was invoked. |
235 assertFalse(exception, "exception in listener " + exception) | 237 assertFalse(exception, "exception in listener " + exception) |
236 assertTrue(listenerComplete); | 238 assertTrue(listenerComplete); |
237 | 239 |
238 //Throw away type information for next run. | 240 //Throw away type information for next run. |
239 gc(); | 241 gc(); |
240 | 242 |
241 Debug.setListener(null); | 243 Debug.setListener(null); |
OLD | NEW |