Skip to content
Snippets Groups Projects
Commit 2981378e authored by Arthur Detroux (ard)'s avatar Arthur Detroux (ard)
Browse files

[FIX] web: mitigate navigation error on iOS/iPadOS devices


Ever since iOS 16.4, going back and forth through a website with the
cache enabled, creates an error in the console which Odoo tries to
handle but fails to do so. Therefor a generic CORS error message
appears.

There is unfortunately no proper way to fix this bug on our end so
instead, this commit tries to mitigate the error by returning early and
not showing the traceback dialog.

I (ARD) have submitted a feedback through Apple's Feedback Assistant app
and will subsequently remove this commit when Apple releases an update
that fixes this.

opw-3281727

closes odoo/odoo#125265

X-original-commit: 19e484b6
Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
parent 41f659e0
Branches
Tags
No related merge requests found
/** @odoo-module **/
import { browser } from "../browser/browser";
import { isIOS } from "../browser/feature_detection";
import { session } from "../../session";
import { ConnectionLostError, RPCError } from "../network/rpc_service";
import { registry } from "../registry";
import {
......@@ -31,6 +33,13 @@ const errorNotificationRegistry = registry.category("error_notifications");
*/
function corsErrorHandler(env, error) {
if (error instanceof UncaughtCorsError) {
// In Safari 16.4+ (as of Jun 14th 2023), an error occurs
// when going back and forward through the browser when the
// cache is enabled. A feedback has been reported but in the
// meantime, hide any script error in these versions.
if (isIOS() && session.is_frontend && odoo.debug !== "assets") {
return true;
}
env.services.dialog.add(NetworkErrorDialog, {
traceback: error.traceback,
message: error.message,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment