On Thu Nov 17 15:39:32 2022 +0000, Gabriel Ivăncescu wrote:
I can't get the unload event sent from Gecko when the SetClientSite is set to NULL, to match the tests. Any ideas here what I should be trying? I guess I can try to `load_nsuri` to "about:blank" but that would need some message pump to wait and dispatch the events since it's async, and might send too many other notifications (no idea). That said we'll still need specialized handler in `nsevents.c` for handle_unload in this case, both for `pagehide` and for the performance timing later. That shouldn't be a problem, though, I don't mind doing it that way. One thing where it might be better is with `beforeunload`. I should probably add tests for `beforeunload` as well since I need to see if it's correct. BTW we can't use gecko for performance timing because it doesn't expose it as XPCOM, and it's more trouble than it's worth, IMO, considering how "simple" it is to set it otherwise (we already even have get_time_stamp() function used for events). But my main issue right now with using gecko's unload is the SetClientSite thing…
Nevermind the SetClientSite, it's CloseView that does it, but it's the same thing. I added proper tests now.
I also implemented beforeunload properly. Gecko sends it to the document, but IE sends it to the window.
I make use of Gecko unload event now, but I also have to send it manually in CloseView. The difference is important too: CloseView does *not* send any beforeunload events, but it does send pagehide.
There are more tests overall (making sure beforeunload is also *not* sent to the document, for example) which should make it more robust.
I also refactored some stuff a bit and cleaned up the special events we handle in `nsevents.c` so it's all in one place now, which makes it way less error prone.