On Tue Nov 29 19:30:03 2022 +0000, Jacek Caban wrote:
The problem is not unique to this event handler. Note that if we'd keep a reference to window instead of document, it would be probably enough. Since those event listeners already operate on the window, maybe it would be better to just store window, instead of document, in nsDocumentEventListener.
Unfortunately I don't think that would be correct, some documents have no window, and that's totally normal (for example those created with createHTMLDocument). Wouldn't events still need to work on them?
How about using a single generic handler (HandleEvent) that obtains refs to the window, calls the specific specialized handler indirectly, and then releases the window? So it's done for all handlers from only one place.