[Webkit-unassigned] [Bug 25475] Show the filename and first line for "(program)" in the Profiler/Debugger
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jun 1 20:23:09 PDT 2009
https://bugs.webkit.org/show_bug.cgi?id=25475
------- Comment #4 from pmuellr at yahoo.com 2009-06-01 20:23 PDT -------
I discovered that FireBug already supports a feature like I suggested in
comment #3. They look for a line of the format
//@ sourceURL=<url>
in eval()'d scripts, and use that as the source url for the script. The dojo
framework has this baked into their code; at development time, they tend to
eval() a lot of the JavaScript code.
Mention of this feature here:
http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt
I did a quick prototype of this, by adding the following code at the end of the
WebInspector.Script constructor in WebCore/Inspector/front-end/Script.js:
// if no URL, look for "//@ sourceURL=" decorator
if (!sourceURL) {
var pattern = /.*\s*\/\/\s*@\s*sourceURL\s*=\s*(\S+)\s*/;
var match = pattern.exec(source);
if (match) {
this.sourceURL = "eval:" + match[1];
}
}
Seems to work ok. Although dojo supports this directly, they sniff the browser
and only add this comment when you're running in Firefox. I "fixed" that code
and all of a sudden 20-30 "(Program)" entries in the scripts pull-down became
useful names.
I'll post some before/after screenshots as attachments.
Questions:
- would this processing be unconditional, for eval()'d scripts? Looks like
FireBug initially enabled this only via user setting, but I don't see a setting
for it anymore. I don't think it would cause much harm to do it
unconditionally.
- this code actually sets the sourceURL to the specified value - prefixed with
"eval:". I figured that we want these in a different "space" than the other
scripts, and it turns out they sort well this way also. I'm tempted to prefix
with " eval:" or "#eval:" to get them all to sort to the top.
- wondering if having these fake sourceURLs will cause a problem for any other
processing; I'll poke around.
- the regex needs some additional work - it's failing in a graceful way on some
incorrectly specified lines (also need to figure out where to put tests for
this).
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list