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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 }; | 127 }; |
128 | 128 |
129 // Add the debug event listener. | 129 // Add the debug event listener. |
130 Debug.setListener(listener); | 130 Debug.setListener(listener); |
131 | 131 |
132 function f() { | 132 function f() { |
133 a=1 | 133 a=1 |
134 }; | 134 }; |
135 | 135 |
136 function g() { | 136 function g() { |
| 137 // Comment. |
137 f(); | 138 f(); |
138 }; | 139 }; |
139 | 140 |
140 eval('function h(){}'); | 141 eval('function h(){}'); |
141 eval('function sourceUrlFunc() { a = 2; }\n//@ sourceURL=sourceUrlScript'); | 142 eval('function sourceUrlFunc() { a = 2; }\n//@ sourceURL=sourceUrlScript'); |
142 | 143 |
143 o = {a:function(){},b:function(){}} | 144 o = {a:function(){},b:function(){}} |
144 | 145 |
145 // Check the script ids for the test functions. | 146 // Check the script ids for the test functions. |
146 f_script_id = Debug.findScript(f).id; | 147 f_script_id = Debug.findScript(f).id; |
(...skipping 30 matching lines...) Expand all Loading... |
177 function breakListener(event) { | 178 function breakListener(event) { |
178 if (event == Debug.DebugEvent.Break) | 179 if (event == Debug.DebugEvent.Break) |
179 breakListenerCalled = true; | 180 breakListenerCalled = true; |
180 } | 181 } |
181 | 182 |
182 Debug.setListener(breakListener); | 183 Debug.setListener(breakListener); |
183 | 184 |
184 sourceUrlFunc(); | 185 sourceUrlFunc(); |
185 | 186 |
186 assertTrue(breakListenerCalled, "Break listener not called on breakpoint set by
sourceURL"); | 187 assertTrue(breakListenerCalled, "Break listener not called on breakpoint set by
sourceURL"); |
| 188 |
| 189 // Set a break point on a line with the comment, and check that actual position |
| 190 // is the next line after the comment. |
| 191 var number = Debug.setScriptBreakPointById(g_script_id, g_line + 1); |
| 192 assertEquals(g_line + 2, Debug.findBreakPoint(number).actual_location.line); |
OLD | NEW |