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)

defect

Tracking

()

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.
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
Carrying over marks from bug 977255.
See Also: → 865313, 637572
Whiteboard: [js:p1]
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.
Depends on: 1037675
(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.
(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?
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 > ..."
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.