require DETH objects to bind to a global




Last year
3 months ago


(Reporter: bkelly, Unassigned)


(Depends on 1 bug, Blocks 1 bug)

Firefox Tracking Flags

(Not tracked)


Bug 1450271 is an example where a DETH subclass leaks because it was never bound to a global and therefore did not receive DisconnectFromOwner().  We should consider changing the API so that we can assert that DETH objects are bound to a global.
Summary: require DETH objects to find to a global → require DETH objects to bind to a global
So right now there are two consumers of the no-arg DETH constructor:

1)  Notification.  This actually binds ... but only on mainthread.  This has a long comment explaining why it needs to be mainthread-only, but that comment seems pretty fishy given that we have other event targets that do bind on non-mainthread.  Certainly the atom bits it's talking about will become irrelevant after bug 1450167, even if they're relevant now (which I don't think they are).

2)  MediaTrack.  Right now we add the track, then Init() it in MediaTrackList::AddTrack.  However, every single place that constructs the MediaTrack has the right owner already, so we could just stop doing this.
Note, in bug 1457867 it appears we are running into problems binding every MediaQueryList to the global.  That crash is a 2GB+ OOM trying to expand the nsIGlobalObject::mEventTargetObjects hash table.  I'm changing MediaQueryList to dynamically bind on first event listener add for now.  Long term we might need a better solution, though.  Particularly if we want to do this bug.
Priority: -- → P3
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.