Index: test/mjsunit/debug-setbreakpoint.js |
diff --git a/test/mjsunit/debug-setbreakpoint.js b/test/mjsunit/debug-setbreakpoint.js |
index 08492b4eccde7e1e2c93c7a29e546a26a56179b6..3981dc45bbbb45c73f670ceb9d03d76d6c736739 100644 |
--- a/test/mjsunit/debug-setbreakpoint.js |
+++ b/test/mjsunit/debug-setbreakpoint.js |
@@ -116,6 +116,8 @@ function listener(event, exec_state, event_data, data) { |
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 @@ function g() { |
}; |
eval('function h(){}'); |
+eval('function sourceUrlFunc() { a = 2; }\n//@ sourceURL=sourceUrlScript'); |
o = {a:function(){},b:function(){}} |
@@ -143,9 +146,12 @@ o = {a:function(){},b:function(){}} |
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 @@ assertEquals(h_line, 0, "invalid line for h"); |
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"); |