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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 { | 112 { |
113 checkFrame0(exec_state.frame(0)); | 113 checkFrame0(exec_state.frame(0)); |
114 checkFrame1(exec_state.frame(1)); | 114 checkFrame1(exec_state.frame(1)); |
115 checkFrame2(exec_state.frame(2)); | 115 checkFrame2(exec_state.frame(2)); |
116 | 116 |
117 // Evaluating a and b on frames 0, 1 and 2 produces 1, 2, 3, 4, 5 and 6. | 117 // Evaluating a and b on frames 0, 1 and 2 produces 1, 2, 3, 4, 5 and 6. |
118 assertEquals(1, exec_state.frame(0).evaluate('a').value()); | 118 assertEquals(1, exec_state.frame(0).evaluate('a').value()); |
119 assertEquals(2, exec_state.frame(0).evaluate('b').value()); | 119 assertEquals(2, exec_state.frame(0).evaluate('b').value()); |
120 assertEquals(5, exec_state.frame(0).evaluate('eval').value()); | 120 assertEquals(5, exec_state.frame(0).evaluate('eval').value()); |
121 assertEquals(3, exec_state.frame(1).evaluate('a').value()); | 121 assertEquals(3, exec_state.frame(1).evaluate('a').value()); |
122 assertEquals(4, exec_state.frame(1).evaluate('b').value()); | 122 // Reference error because g does not reference b. |
| 123 assertThrows(() => exec_state.frame(1).evaluate('b'), ReferenceError); |
123 assertEquals("function", | 124 assertEquals("function", |
124 typeof exec_state.frame(1).evaluate('eval').value()); | 125 typeof exec_state.frame(1).evaluate('eval').value()); |
125 assertEquals(5, exec_state.frame(2).evaluate('a').value()); | 126 assertEquals(5, exec_state.frame(2).evaluate('a').value()); |
126 assertEquals(6, exec_state.frame(2).evaluate('b').value()); | 127 assertEquals(6, exec_state.frame(2).evaluate('b').value()); |
127 assertEquals("function", | 128 assertEquals("function", |
128 typeof exec_state.frame(2).evaluate('eval').value()); | 129 typeof exec_state.frame(2).evaluate('eval').value()); |
129 assertEquals("foo", | 130 assertEquals("foo", |
130 exec_state.frame(0).evaluate('a = "foo"').value()); | 131 exec_state.frame(0).evaluate('a = "foo"').value()); |
131 assertEquals("bar", | 132 assertEquals("bar", |
132 exec_state.frame(1).evaluate('a = "bar"').value()); | 133 exec_state.frame(1).evaluate('a = "bar"').value()); |
133 // Indicate that all was processed. | 134 // Indicate that all was processed. |
134 listenerComplete = true; | 135 listenerComplete = true; |
135 } | 136 } |
136 } catch (e) { | 137 } catch (e) { |
137 exception = e; | 138 exception = e; |
138 print("Caught something. " + e + " " + e.stack); | 139 print("Caught something. " + e + " " + e.stack); |
139 }; | 140 }; |
140 }; | 141 }; |
141 | 142 |
142 // Add the debug event listener. | 143 // Add the debug event listener. |
143 Debug.setListener(listener); | 144 Debug.setListener(listener); |
144 | 145 |
145 var f_result = f(); | 146 var f_result = f(); |
146 | 147 |
147 assertEquals('foobar', f_result); | 148 assertEquals('foobar', f_result); |
148 | 149 |
149 // Make sure that the debug event listener was invoked. | 150 // Make sure that the debug event listener was invoked. |
150 assertFalse(exception, "exception in listener") | 151 assertFalse(exception, "exception in listener") |
151 assertTrue(listenerComplete); | 152 assertTrue(listenerComplete); |
OLD | NEW |