Bug 38662 - Web Inspector: //# sourceURL does not work with eval and the profiler
Summary: Web Inspector: //# sourceURL does not work with eval and the profiler
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-05-06 10:43 PDT by Patrick Mueller
Modified: 2016-04-20 17:26 PDT (History)
12 users (show)

See Also:


Attachments
test case showing problem (3.36 KB, text/html)
2010-05-06 10:45 PDT, Patrick Mueller
no flags Details
screenshot showing problem (26.19 KB, image/png)
2010-05-06 10:46 PDT, Patrick Mueller
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Mueller 2010-05-06 10:43:13 PDT
When using the "//@sourceURL=" annotation in an eval()'d string, the source location will show up in the debugger, including using the specified sourceURL.

However, no source location information is available for such "scripts" in the profiler.
Comment 1 Patrick Mueller 2010-05-06 10:45:01 PDT
Created attachment 55261 [details]
test case showing problem
Comment 2 Patrick Mueller 2010-05-06 10:46:18 PDT
Created attachment 55264 [details]
screenshot showing problem

The orange round-rectangles, pointed to by the red arrows, show where the source location should be displayed, but isn't.
Comment 3 Patrick Mueller 2010-05-07 12:27:06 PDT
Looks to me, like the best approach here is to arrange for the sourceID to come in from the profiling data (it currently is NOT), and then do the sourceID lookup against the _sourceIDMap in ScriptPanel back in JavaScript.  The ScriptsPanel should have access to the sourceURL, which is parsed in the Script class.  ScriptPanel would need to be extended to provide an sourceID->Script lookup function.

One place to start looking where to get the sourceID sent back from the profiler is in CallIdentifier (JSC/profiler/CallIdentifier.h).  Various places in JSC/profiler/ProfileGenerator.cpp, for instance, create CallIdentifer AND have access to the sourceID.

I'm not entirely certain whether the sourceID in the profiler is the same as the one that comes into the ScriptPanel, but initial checks seem to indicate that they are.

All this is just for JSC; V8 would need a different but similar set of changes, presumably.

Seems kind of expensive, in terms of code hits, for a missing feature not many people have missed.

One note though - message sends from the profiler into WI, seem to be sending the sourceURL all the time.  If we sent the sourceID instead, we could look up the sourceURL in WI JavaScript code (as suggested above).  Could be a savings there.  That may even flow back farther in the Profiling code - perhaps we don't really need to ever have the sourceURL available to the profiler if the sourceID is available instead.
Comment 4 Radar WebKit Bug Importer 2014-04-14 17:47:47 PDT
<rdar://problem/16615742>
Comment 5 Timothy Hatcher 2016-02-04 20:23:16 PST
Is this an issue with the new sampling profiler?
Comment 6 Patrick Mueller 2016-02-05 15:20:23 PST
The bug title specifically mentions `eval()`, which was one weird trick to do sourcemap-py stuff 6 years ago.  If the bug only impacts `eval()` usage of sourcemaps, I doubt this is going to affect anyone.
Comment 7 Joseph Pecoraro 2016-04-20 17:26:02 PDT
Attached test case works as expected in the new profiler.