Open Bug 1095159 Opened 10 years ago Updated 2 years ago

SpiderMonkey should assert that all scripts are reported to Debugger before they are executed

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

People

(Reporter: jimb, Unassigned)

References

(Blocks 1 open bug)

Details

Debugger's onNewScript hook is supposed to give tools a chance to set breakpoints in newly introduced JS code before it is executed. However, historically, new ways of introducing scripts to the system (cloning functions; lazy compilation; off-thread compilation) have often failed to report the new code to Debugger. The usual visible effect is that breakpoints are missed.

JSScripts should have a flag that is clear when the script is built; set when the script is reported to Debugger; and checked when the script is executed.

Since we only report the root of a tree of scripts to Debugger directly, Debugger should mark all the descendants of the script it receives as having been reported.

js::LazyScripts should never exist in compartments being debugged, but the point here is to catch unreported scripts. Hence, LazyScripts should have a flag indicating that their parent was reported; and compiling a LazyScript to yield as JSScript should propagate that flag to the JSScript.

I'll have a patch for this shortly. Unfortunately, at the moment this would catch more bugs than we can cope with. I'll mark those as blockers of this bug.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.