RESOLVED FIXED123231
Web Inspector: Breakpoints in sourceURL named scripts do not work
https://bugs.webkit.org/show_bug.cgi?id=123231
Summary Web Inspector: Breakpoints in sourceURL named scripts do not work
Joseph Pecoraro
Reported 2013-10-23 16:20:54 PDT
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
Attachments
[PATCH] Proposed Fix (8.83 KB, patch)
2013-10-24 10:42 PDT, Joseph Pecoraro
no flags
Radar WebKit Bug Importer
Comment 1 2013-10-23 16:21:01 PDT
Joseph Pecoraro
Comment 2 2013-10-23 17:21:55 PDT
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!
Joseph Pecoraro
Comment 3 2013-10-23 18:19:33 PDT
I have a fix, I just need to write up a test for it.
Joseph Pecoraro
Comment 4 2013-10-24 10:42:52 PDT
Created attachment 215081 [details] [PATCH] Proposed Fix
Timothy Hatcher
Comment 5 2013-10-24 10:51:19 PDT
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?
Joseph Pecoraro
Comment 6 2013-10-24 10:55:35 PDT
(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.
WebKit Commit Bot
Comment 7 2013-10-24 11:20:39 PDT
Comment on attachment 215081 [details] [PATCH] Proposed Fix Clearing flags on attachment: 215081 Committed r157939: <http://trac.webkit.org/changeset/157939>
WebKit Commit Bot
Comment 8 2013-10-24 11:20:41 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.