Closed Bug 907930 Opened 12 years ago Closed 5 years ago

[jsdbg] Debugger should be able to wrap globals without making them debuggees

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jimb, Unassigned)

Details

Debugger.prototype should have a method that takes a global object and returns a Debugger.Object that refers to that global, without making the global a debuggee. At the moment, one can use Debugger.prototype.addDebuggee to get a D.O referring to a given global, but putting the global's compartment in debug mode has performance consequences that we'd like to avoid. While scripts, frames, and environments are all "debuggee" or "non-debuggee", we don't make the same distinction for objects, because objects don't have any essential relationship to any particular scope: operations on objects are well-defined without reference to any particular global. So it doesn't seem like this would break the Debugger model. This would provide a natural way to create a D.O referring to an arbitrary object, given the global from which you want to view said object: dbg.globalObject(global).makeDebuggeeValue(obj) This would allow the web console to avoid the following gyrations, which force full DEBUG_MODE_GC collections: /** * Get the Debugger.Object for the given global object (usually a window * object). * * @private * @param object aGlobal * The global object for which you want a Debugger.Object. * @return Debugger.Object * The Debugger.Object for the given global object. */ _getDebuggerGlobal: function WCA__getDebuggerGlobal(aGlobal) { let windowId = WebConsoleUtils.getInnerWindowId(aGlobal); if (!this._dbgGlobals.has(windowId)) { let dbgGlobal = this.dbg.addDebuggee(aGlobal); this.dbg.removeDebuggee(aGlobal); this._dbgGlobals.set(windowId, dbgGlobal); } return this._dbgGlobals.get(windowId); },
Totally. Heh, I'm a little disappointed in myself that I didn't see this "blind spot" in the design of Debugger.Object.prototype.makeDebuggeeValue.
Assignee: general → nobody

The debugger has dbg.makeGlobalObjectReference(global) so this was fixed long ago.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.