Index: test/mjsunit/debug-setbreakpoint.js |
=================================================================== |
--- test/mjsunit/debug-setbreakpoint.js (revision 4328) |
+++ test/mjsunit/debug-setbreakpoint.js (working copy) |
@@ -116,6 +116,8 @@ |
mirror = debug.MakeMirror(o.a); |
testArguments(dcp, '{"type":"handle","target":' + mirror.handle() + '}', true, false); |
+ testArguments(dcp, '{"type":"script","target":"sourceUrlScript","line":1}', true, true); |
+ |
// Indicate that all was processed. |
listenerComplete = true; |
} |
@@ -136,6 +138,7 @@ |
}; |
eval('function h(){}'); |
+eval('function sourceUrlFunc() { a = 2; }\n//@ sourceURL=sourceUrlScript'); |
o = {a:function(){},b:function(){}} |
@@ -143,9 +146,12 @@ |
f_script_id = Debug.findScript(f).id; |
g_script_id = Debug.findScript(g).id; |
h_script_id = Debug.findScript(h).id; |
+sourceURL_script_id = Debug.findScript(sourceUrlFunc).id; |
+ |
assertTrue(f_script_id > 0, "invalid script id for f"); |
assertTrue(g_script_id > 0, "invalid script id for g"); |
assertTrue(h_script_id > 0, "invalid script id for h"); |
+assertTrue(sourceURL_script_id > 0, "invalid script id for sourceUrlFunc"); |
assertEquals(f_script_id, g_script_id); |
// Get the source line for the test functions. |
@@ -161,5 +167,20 @@ |
Debug.setBreakPoint(g, 0, 0); |
g(); |
-// Make sure that the debug event listener vas invoked. |
+// Make sure that the debug event listener was invoked. |
assertTrue(listenerComplete, "listener did not run to completion: " + exception); |
+ |
+// Try setting breakpoint by url specified in sourceURL |
+ |
+var breakListenerCalled = false; |
+ |
+function breakListener(event) { |
+ if (event == Debug.DebugEvent.Break) |
+ breakListenerCalled = true; |
+} |
+ |
+Debug.setListener(breakListener); |
+ |
+sourceUrlFunc(); |
+ |
+assertTrue(breakListenerCalled, "Break listener not called on breakpoint set by sourceURL"); |