Bug 1903034 - Call DropJSObjects after a promise callback has been called r=mccr8

For promise callbacks we call CallbackObject::Reset after the callback has been
called to clear JS references and avoid keeping JS GC things around longer than
necessary (promise callbacks can only be called once).

We don't need to keep the callback object in the JS holders table after this
point.

Differential Revision: https://phabricator.services.mozilla.com/D213949
This commit is contained in:
Jon Coppeard 2024-06-17 13:42:12 +00:00
parent 766ad95b55
commit 009b9bd811

View File

@ -264,7 +264,10 @@ class CallbackObject : public nsISupports {
// this point. This should only be called if the object is known not to be
// used again, and no handles (e.g. those returned by CallbackPreserveColor)
// are in use.
void Reset() { ClearJSReferences(); }
void Reset() {
ClearJSReferences();
mozilla::DropJSObjects(this);
}
friend class mozilla::PromiseJobRunnable;
inline void ClearJSReferences() {