Open Bug 1257665 Opened 8 years ago Updated 2 years ago

[jsdbg2] Debugger.Object is too hard to specialize for object classes

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

People

(Reporter: jimb, Unassigned)

References

(Blocks 1 open bug)

Details

It should be easier to add class-specific introspection accessors and methods to Debugger.Object instances.

Adding Debugger.Object introspection methods and accessors for a particular object type is ugly, because D.O.prototype ends up being an overflowing basket of accessors for all supported types.

For example, the following accessors on D.O.p are meaningful only for functions:

name
displayName
parameterNames
script
environment
isArrowFunction
isBoundFunction

and the following only for bound functions:

boundTargetFunction
boundThis
boundArguments

If we added support for inspecting proxies and WeakMaps (both of which have bugs open), those would further the problem.

It might be nice, instead, to give Debugger.Object instances a two-level prototype chain, where the proto-parent has class-specific methods and accessors, and Debugger.Object.prototype continues to carry generic operations. If we could make it non-wizardry for specific kinds of objects to define their own D.O sub-prototypes, then we could get code out of Debugger.cpp and put it next to the implementations of the types it supports.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.