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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 assertPropertiesEqual(expected_locals, locals); | 73 assertPropertiesEqual(expected_locals, locals); |
74 | 74 |
75 // All frames except the bottom one have expected arguments. | 75 // All frames except the bottom one have expected arguments. |
76 for (var j = 0; j < expected_args.names.length; j++) { | 76 for (var j = 0; j < expected_args.names.length; j++) { |
77 assertEquals(expected_args.names[j], frame.argumentName(j)); | 77 assertEquals(expected_args.names[j], frame.argumentName(j)); |
78 assertEquals(expected_args.values[j], | 78 assertEquals(expected_args.values[j], |
79 frame.argumentValue(j).value()); | 79 frame.argumentValue(j).value()); |
80 } | 80 } |
81 | 81 |
82 // All frames except the bottom one have two scopes. | 82 // All frames except the bottom one have three scopes. |
83 assertEquals(2, frame.scopeCount()); | 83 assertEquals(3, frame.scopeCount()); |
84 assertEquals(debug.ScopeType.Local, frame.scope(0).scopeType()); | 84 assertEquals(debug.ScopeType.Local, frame.scope(0).scopeType()); |
85 assertEquals(debug.ScopeType.Global, frame.scope(1).scopeType()); | 85 assertEquals(debug.ScopeType.Script, frame.scope(1).scopeType()); |
| 86 assertEquals(debug.ScopeType.Global, frame.scope(2).scopeType()); |
86 | 87 |
87 Object.keys(expected_locals).forEach(function (name) { | 88 Object.keys(expected_locals).forEach(function (name) { |
88 assertEquals(expected_locals[name], | 89 assertEquals(expected_locals[name], |
89 frame.scope(0).scopeObject().value()[name]); | 90 frame.scope(0).scopeObject().value()[name]); |
90 }); | 91 }); |
91 | 92 |
92 for (var j = 0; j < expected_args.names.length; j++) { | 93 for (var j = 0; j < expected_args.names.length; j++) { |
93 var arg_name = expected_args.names[j]; | 94 var arg_name = expected_args.names[j]; |
94 var arg_value = expected_args.values[j]; | 95 var arg_value = expected_args.values[j]; |
95 assertEquals(arg_value, | 96 assertEquals(arg_value, |
(...skipping 21 matching lines...) Expand all Loading... |
117 frame.evaluate(Object.keys(expected_locals).join('+') + | 118 frame.evaluate(Object.keys(expected_locals).join('+') + |
118 ' + ' + | 119 ' + ' + |
119 expected_args.names.join('+')).value()); | 120 expected_args.names.join('+')).value()); |
120 | 121 |
121 var arguments_sum = expected_args.names.map(function(_, idx) { | 122 var arguments_sum = expected_args.names.map(function(_, idx) { |
122 return "arguments[" + idx + "]"; | 123 return "arguments[" + idx + "]"; |
123 }).join('+'); | 124 }).join('+'); |
124 assertEquals(expected_args_sum, | 125 assertEquals(expected_args_sum, |
125 frame.evaluate(arguments_sum).value()); | 126 frame.evaluate(arguments_sum).value()); |
126 } else { | 127 } else { |
127 // The bottom frame only have the global scope. | 128 // The bottom frame only have the script scope and the global scope. |
128 assertEquals(1, frame.scopeCount()); | 129 assertEquals(2, frame.scopeCount()); |
129 assertEquals(debug.ScopeType.Global, frame.scope(0).scopeType()); | 130 assertEquals(debug.ScopeType.Script, frame.scope(0).scopeType()); |
| 131 assertEquals(debug.ScopeType.Global, frame.scope(1).scopeType()); |
130 } | 132 } |
131 | 133 |
132 // Check the frame function. | 134 // Check the frame function. |
133 switch (i) { | 135 switch (i) { |
134 case 0: assertEquals(h, frame.func().value()); break; | 136 case 0: assertEquals(h, frame.func().value()); break; |
135 case 1: assertEquals(g3, frame.func().value()); break; | 137 case 1: assertEquals(g3, frame.func().value()); break; |
136 case 2: assertEquals(g2, frame.func().value()); break; | 138 case 2: assertEquals(g2, frame.func().value()); break; |
137 case 3: assertEquals(g1, frame.func().value()); break; | 139 case 3: assertEquals(g1, frame.func().value()); break; |
138 case 4: assertEquals(f, frame.func().value()); break; | 140 case 4: assertEquals(f, frame.func().value()); break; |
139 case 5: break; | 141 case 5: break; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 new f(expected.length - 1, 11, 12, 0); | 215 new f(expected.length - 1, 11, 12, 0); |
214 | 216 |
215 // Make sure that the debug event listener was invoked. | 217 // Make sure that the debug event listener was invoked. |
216 assertFalse(exception, "exception in listener " + exception) | 218 assertFalse(exception, "exception in listener " + exception) |
217 assertTrue(listenerComplete); | 219 assertTrue(listenerComplete); |
218 | 220 |
219 // Throw away type information for next run. | 221 // Throw away type information for next run. |
220 gc(); | 222 gc(); |
221 | 223 |
222 Debug.setListener(null); | 224 Debug.setListener(null); |
OLD | NEW |