[jsdbg2] findAllGlobals is GC-sensitive and GC-unnatural and should be replaced
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
People
(Reporter: jimb, Unassigned)
References
(Blocks 1 open bug)
Details
Because Debugger.prototype.findAllGlobals scans zones and realms for global objects, its return value can depend on the timing of GC, and can return globals in the process of being destroyed which are no longer safe to use (for example, bug 1542461). The fact that this function may suddenly produce a pointer to an object that is otherwise completely unreachable by ordinary JS is rightly astonishing to the GC and CC.
An alternative interface: maybe an API that devtools could hand a callback saying, "please apply this callback to every new global we're about to try to execute JavaScript in - only one call per global per hook." Then the devtools would have a chance to add every global as a debuggee before any code runs in it, but globals on their way out would never enter the picture, simply because we'd never try to use them again. (I think there's a good way to implement that notification that works efficiently with many globals and multiple debuggers.)
It might be convenient to implement this after, or along with, fixing 1542574.
Updated•6 years ago
|
Updated•2 years ago
|
Updated•4 months ago
|
Description
•