SUMMARY: Breakpoints in "//# sourceURL=foo" named scripts do not work. TEST CASE: <button id="button">Click to Run foo()</button> <script> eval("function foo() {\n debugger;\n var a = 1;\n var b = 2;\n var c = a+b;\n alert(c);\n}\n//# sourceURL=test.js") document.getElementById('button').addEventListener("click", function() { foo(); }); </script> STEPS TO REPRODUCE: 1. Inspect test page. 2. Click button on inspected page. (Debugger pauses on debugger statement. 3. Set a breakpoint before the alert() statement 4. Click continue in the debugger => expected to hit the breakpoint, instead the alert happened
<rdar://problem/15304492>
So InspectorDebuggerAgent::didParseSource keep track of all loaded Scripts. Unfortunately when setting breakpoints by URL, we check Script.url, and the "sourceURL" is lost at this point. We should save the sourceURL somewhere; on the script would be great!
I have a fix, I just need to write up a test for it.
Created attachment 215081 [details] [PATCH] Proposed Fix
Comment on attachment 215081 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=215081&action=review > Source/WebCore/inspector/InspectorDebuggerAgent.cpp:714 > + String scriptURL = hasSourceURL ? script.sourceURL : script.url; I wonder if we should just have one property — script.url — for the URL. Are both useful? Are other places that need to do something similar?
(In reply to comment #5) > (From update of attachment 215081 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=215081&action=review > > > Source/WebCore/inspector/InspectorDebuggerAgent.cpp:714 > > + String scriptURL = hasSourceURL ? script.sourceURL : script.url; > > I wonder if we should just have one property — script.url — for the URL. Are both useful? Are other places that need to do something similar? I like the idea of having both around. I think ideally both the original URL and sourceURL could be sent to the frontend.
Comment on attachment 215081 [details] [PATCH] Proposed Fix Clearing flags on attachment: 215081 Committed r157939: <http://trac.webkit.org/changeset/157939>
All reviewed patches have been landed. Closing bug.