The original goal here is to remove the warning of the google page speed but it actually is really better to use 'pagehide' as it is fired more reliably than the 'unload' event and does not prevent Chrome and Firefox to use the bfcache (browser optimization that enables instant back and forward navigation). The persisted property of the pagehide event is checked before disconnecting from the worker. As for the presence/multi_tab case, it was chosen to also consider page freezing as it seems more accurate that what was done before (the main tab could be throttled/frozen which was an issue). Some resources to explain why this is better: - https://web.dev/bfcache/#never-use-the-unload-event - https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event closes odoo/odoo#101309 X-original-commit: e043891d5074ca04ee1bbed421ae5efe5f2f8b88 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: qsm-odoo <qsm@odoo.com>