Open
Bug 957798
Opened 11 years ago
Updated 3 years ago
[jsdbg2] Debugger.Script and Debugger.Source objects should not pretend dynamically generated scripts have urls
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
NEW
People
(Reporter: jimb, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [js:p1])
At the moment, a Debugger.Script referring to a dynamically generated script (i.e., one resulting from a call to 'eval' or 'Function') will claim that the script's URL is the same as that of the script in which the call to 'eval' or 'Function' occurred. Debugger.Source behaves similarly.
This is misleading: the code being executed cannot be found at that URL. Debugger.Source is specified to provide enough information to tell the whole story; once that is fully implemented, we will have a more attractive alternative than these false URLs to providing no information at all.
Comment 1•11 years ago
|
||
Here is a test case that shows accidental breakpoint hit in dynamic script, which happens because of the shared URL.
1) Load: https://getfirebug.com/tests/manual/issues/7097/issue7097-1.html
2) Follow instructions on the page.
3) Instead of "Open Firebug and enable the Script panel." use the built-in debugger.
Jim, this test case will be fixed together with this report, correct?
I think it happens because a breakpoint is set to all scripts that are returned in
ThreadActor._setBrekpoint for specific location:
https://github.com/mozilla/gecko-dev/blob/master/toolkit/devtools/server/actors/script.js#L1434
// Find all scripts matching the given location
let scripts = this.dbg.findScripts(aLocation);
Can we also set Firefox 29 as the target for this bug?
Honza
Reporter | ||
Comment 3•11 years ago
|
||
Carrying over marks from bug 977255.
Comment 4•11 years ago
|
||
Would eval sources return `null` for URLs? It seems useful to still track information for where the eval was called, at least for stack traces.
Comment 5•10 years ago
|
||
(In reply to James Long (:jlongster) from comment #4)
> Would eval sources return `null` for URLs? It seems useful to still track
> information for where the eval was called, at least for stack traces.
This is what introductionSite is for.
Comment 6•10 years ago
|
||
(In reply to Nick Fitzgerald [:fitzgen] from comment #5)
> (In reply to James Long (:jlongster) from comment #4)
> > Would eval sources return `null` for URLs? It seems useful to still track
> > information for where the eval was called, at least for stack traces.
>
> This is what introductionSite is for.
I think you mean introductionScript. But yeah, I was thinking mainly about stack traces. An eval frame won't have a url in it, right? Since you just have the stack, you can't look at introductionScript... but maybe people should just use sourceURL in their evals?
Comment 7•10 years ago
|
||
Yes, sorry.
Fixing Debugger.Source.prototype.url shouldn't change Error.prototype.stack traces, which create "sources" of the form "site 1 eval > site 2 eval > ..."
Updated•5 years ago
|
Blocks: js-debugger
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•