It looks like the purpose of registering the unload handler for any Window 
event is to avoid IE6-10 era memory leaks. From the notes on the MDN page, 
removing those other handlers will break the page when the bfcache is in 
use, but our use of the unload handler will opt GWT pages out.

The simplest fix appears to be to stop initializing the unload event 
tracking for resize/scroll events, and "let" those leak (which they won't, 
because IE in all forms is really-actually-totally-dead this time, right?). 
Next unload/beforeunload should be decoupled, so that each can be 
initialized separately. Then applications can remove their own usage of 
unload as they wish, but we should probably deprecate this event handler 
method (not the event and handler itself) as well.

I have filed https://github.com/gwtproject/gwt/issues/9908 to track this.

On Thursday, January 25, 2024 at 11:38:53 AM UTC-6 Thomas Broyer wrote:

> Yes: https://developer.mozilla.org/en-US/docs/Web/API/Window/unload_event
> Apparently, this happens when you use Window.addXxxHandler (and for 
> instance the default PlaceController's delegate calls 
> Window.addClosingHandler, which registers an unload handler but is only 
> interested in the beforeunload event)
>
> On Thursday, January 25, 2024 at 5:18:39 PM UTC+1 ofr...@gmail.com wrote:
>
>> Hello.
>>
>> Browsers running our GWT application (version 2.11) have recently (this 
>> week) started reporting errors like this one:
>>
>> [{"age":41550,"body":{"columnNumber":192,"id":"UnloadHandler
>> ","lineNumber":3210,"message":"Unload event listeners are deprecated and 
>> will be removed.","sourceFile":"ourmodule-0.js"},"type":"deprecation","
>> url":"oururl","user_agent":"Mozilla/5.0 (Linux; Android 10; K) 
>> AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Mobile 
>> Safari/537.36"}]
>>
>> Any idea about why is this happening?  Is GWT using a deprecated browser 
>> feature?
>>
>> Thanks!
>> Oscar
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/b02836a4-290b-4691-ac29-d158bc08c997n%40googlegroups.com.

Reply via email to