Open Bug 639001 Opened 13 years ago Updated 1 year ago

JSContext debugging hook pointer should be moved to JSCompartment


(Core :: JavaScript Engine, defect)





(Reporter: jimb, Unassigned)


(Blocks 1 open bug)


At the moment, we choose which debug hook function to call when an event occurs in a JS debuggee by consulting a 'JSDebugHooks *' in the current context. I would like to move this pointer to the JSCompartment. That is, hook references that now look like cx->debugHooks->mumbleHook would become cx->compartment->debugHooks->mumbleHook.

Why? Compartments are a natural choice for the extent of a JavaScript debuggee. In content, they correspond to origins. They also work nicely for debugger/debuggee separation, as the wrapper logic can enforce restrictions on how debugger and debuggee objects refer to each other. Contexts don't work so well, since they're invisible at the JavaScript level. Runtimes are too broad; we want to be able to establish hooks for the debuggee without any risk of the debugger's own code triggering them.

This change shouldn't affect jsd, since that ignores the JSContext's JSDebugHooks pointer and manipulates only the JSRuntime's hook functions. As far as I can tell, Firefox does not use the per-context pointers either, beyond calling JS_ClearContextDebugHooks to avoid dragging Firebug into worker thread activities.
Blocks: 636907
Depends on: 640468
Component: JavaScript Debugging/Profiling APIs → JavaScript Engine
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.