reiern70 opened a new pull request, #1963: URL: https://github.com/apache/wicket/pull/1963
Closes #1962 Both Ajax engines, `wicket-ajax-jquery.js` and the jQuery-free `wicket-ajax.js`, bound a listener for `unload` on `window` that called `Wicket.Timer.clearAll()`. Browsers are deprecating `unload` listeners. Where Chrome has turned them off, it does not run the listener and logs `[Violation] Permissions policy violation: unload is not allowed in this document` on every page that loads the Ajax engine. Where the listener still runs, it keeps the page out of the back/forward cache. The listener was not needed in the first place: the timers end with the document that scheduled them. ### What it does now The listener is gone from both engines. It is not replaced by a `pagehide` listener: `pagehide` also fires when the page goes into the back/forward cache, and the timers would then be gone when the user comes back to the page. ### What applications see Nothing changes when a page is left for good. A page that Chrome kept out of the back/forward cache only because of Wicket's listener can now be cached, and when the user goes back to it, its Ajax timers are still running. `Wicket.Timer.clearAll()` stays, for applications that clear the timers themselves. No Java API change, nothing to migrate. Applications that used the workaround from the issue (`jQuery.event.special.unload`) can drop it. ### Backport To `wicket-11.x` in BACKPORT_11 and to `wicket-10.x` in BACKPORT_10. 10.x has only the jQuery engine. ### Tests No QUnit test: neither engine can list the native listeners it has bound, so a test would have to hook `addEventListener` before the engine loads. Checked by hand instead, with Puppeteer, before and after the change, for both engines, in Chrome and Firefox: - Before: one `unload` listener on `window`. Chrome does not use the back/forward cache (`UnloadHandlerExistsInMainFrame`). - After: no `unload` listener. Chrome restores the page from the back/forward cache. No script errors. `mvn clean verify -Pjs-test` is green. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
