Open Bug 1452705 Opened 6 years ago Updated 2 years ago

require DETH objects to bind to a global

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: bkelly, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

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.
Depends on: 1452743
Depends on: 1452741
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
Depends on: 1478100
Depends on: 1478101
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.