- From: Scott Haseley <notifications@github.com>
- Date: Fri, 22 Jul 2022 11:36:49 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1085/c1192839911@github.com>
> Firefox has checks in the webidl callbacks layer to prevent calling listener in the globals which are "gone". The global of the `EventTarget` or the listener? In this case, the checks are about the global of the `EventTarget`, i.e. the listener's global can still be attached, but the target's is not. When I filed the issue, I did some debugging in FF code to see if I could figure out where the check was happening. I observed the following: 1. If the `EventTarget`'s global is detached when dispatching events, we hit an early out in [EventTargetChainItem::HandleEvent](https://searchfox.org/mozilla-central/source/dom/events/EventDispatcher.cpp#318)() because the `EventListenerManager` is null. 2. If the `EventTarget`'s global is detached during dispatch, I found iteration during `HandleEventInternal()` abruptly ends because the listeners got cleared. This happens, for example, if there are two event listeners and the first detaches the event target's global. I found [code](https://searchfox.org/mozilla-central/source/dom/base/nsIGlobalObject.cpp#65) that "disconnects" the event targets and clears listeners which I *think* caused this, but regardless I definitely observed iteration ending after the first event listener detached the event target's global. I don't know this code nearly as well as y'all, but this is what I observed with some hacky printf debugging; hopefully that's helpful. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/1085#issuecomment-1192839911 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/pull/1085/c1192839911@github.com>
Received on Friday, 22 July 2022 18:37:03 UTC