Until the auditor architecture is implemented, a debuggee global's vector of `Debugger`s should be stored on the debuggee's `JS::Realm` structure, not as a `GlobalDebuggees` object pointed to by a slot on the global. Since there are many subclasses of `GlobalObject`, each with their own `JS::Class` and hence their own `finalize` hook, there's no convenient place to put the cleanup of the `DebuggerVector`; hence the `GlobalDebuggees` object, with its custom finalizer. But this predates the existence of the `JS::Realm` type; now it would make more sense to let the `Realm` own the `DebuggerVector`, and let its destructor delete it naturally.
Bug 1564177 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Until the [auditor architecture][auditor] is implemented, a debuggee global's vector of `Debugger`s should be stored on the debuggee's `JS::Realm` structure, not as a `GlobalDebuggees` object pointed to by a slot on the global. [auditor]: https://bugzilla.mozilla.org/show_bug.cgi?id=1564174 Since there are many subclasses of `GlobalObject`, each with their own `JS::Class` and hence their own `finalize` hook, there's no convenient place to put the cleanup of the `DebuggerVector`; hence the `GlobalDebuggees` object, with its custom finalizer. But this predates the existence of the `JS::Realm` type; now it would make more sense to let the `Realm` own the `DebuggerVector`, and let its destructor delete it naturally.
Until the [auditor architecture][auditor] is implemented, a debuggee global's vector of `Debugger`s should be stored on the debuggee's `JS::Realm` structure, not as a `GlobalDebuggees` object pointed to by a slot on the global. [auditor]: https://bugzilla.mozilla.org/show_bug.cgi?id=1564174 Since there are many subclasses of `GlobalObject`, each with their own `JS::Class` and hence their own `finalize` hook, there's no convenient place to put the cleanup of the `DebuggerVector`; hence the `GlobalDebuggerVectorHolder` object, with its custom finalizer. But this predates the existence of the `JS::Realm` type; now it would make more sense to let the `Realm` own the `DebuggerVector`, and let its destructor delete it naturally. GlobalDebuggerVectorHolder's JSClass: https://searchfox.org/mozilla-central/source/js/src/debugger/Debugger.cpp#539