[FIX] website_event_track: crash in SWs fetch listener on Safari 17.0+ #1223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a cherry pick of odoo@7a5cabe
Description of the issue/feature this PR addresses:
This PR addresses an issue opening events on Safari Browser 17.0+
Opening another event after having looked at another one leads to a Browser Crash
Current behavior before PR:
Before this commit, when browsing the "Events" part of website on Safari
(both macOS and iOS/ipadOS), the page could be loaded only once and
returns a "FetchEvent.respondWith received an error: NotSupportedError:
The operation is not supported." error message on afterward, completely
blocking access to everything under the
/event
path.This error is actually thrown from the ServiceWorker's
fetch
event'slistener, and more specifically, from the storage availablity check.
Since Safari 17.0, the Storage API - and in this case its
estimate()
function - has been enabled in WebKit's builds for Apple platforms (see
WebKit PR [1]). But even if this feature should be available in Web
Workers (cf. MDN [2] and the spec [3]), it returns a NotSupportedError
error when called from the ServiceWorker on Safari 17.0+ (but works fine
in the global scope).
Desired behavior after PR is merged:
Any event can be opened on Safari Browser without Crashing the page
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr