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




5 years ago
4 years ago


(Reporter: jimb, Unassigned)


Firefox Tracking Flags

(Not tracked)




5 years ago
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:


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._dbgGlobals.set(windowId, dbgGlobal);
    return this._dbgGlobals.get(windowId);

Heh, I'm a little disappointed in myself that I didn't see this "blind spot" in the design of Debugger.Object.prototype.makeDebuggeeValue.


4 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.