summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2018-09-07 16:35:22 +0200
committerRomain Derie <rde@odoo.com>2018-09-08 12:58:53 +0200
commit3a496f18fa6aa6ca41dfd901b986e58456fe89e5 (patch)
treefa07e0d76e43d749a14ed7dce0702c519fdb3371
parente1b142bd9f31f4b9b34389cbc0630f7caef7ab0c (diff)
[FIX] web: forward-port 10.0->11.0 (CORS error handle)
CORS error was firsly fixed with 4bd8e3e2ed48 in 11.0 Then it was cherry-pick'd and improved in 10.0 with 9f1438d5f1b. But the improvement was lost during forward port from 10.0 to 11.0. This commit adds the lost fix. Closes #26812
-rw-r--r--addons/web/static/src/js/chrome/abstract_web_client.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js
index 939f73bd315..20576a168f9 100644
--- a/addons/web/static/src/js/chrome/abstract_web_client.js
+++ b/addons/web/static/src/js/chrome/abstract_web_client.js
@@ -177,7 +177,9 @@ var AbstractWebClient = Widget.extend(mixins.ServiceProvider, {
// If it is not handled, we should display something clearer than the common crash_manager error dialog
// since it won't show anything except "Script error."
// This link will probably explain it better: https://blog.sentry.io/2016/05/17/what-is-script-error.html
- if (message === "Script error." && !file && !line && !col && !error) {
+ if (!file && !line && !col) {
+ // Chrome and Opera set "Script error." on the `message` and hide the `error`
+ // Firefox handles the "Script error." directly. It sets the error thrown by the CORS file into `error`
if (window.onOriginError) {
window.onOriginError();
delete window.onOriginError;
@@ -185,7 +187,7 @@ var AbstractWebClient = Widget.extend(mixins.ServiceProvider, {
crash_manager.show_error({
type: _t("Odoo Client Error"),
message: _t("Unknown CORS error"),
- data: {debug: _t("An unknown CORS error occured. The error probably originates from a JavaScript file served from a different origin.")},
+ data: {debug: _t("An unknown CORS error occured. The error probably originates from a JavaScript file served from a different origin. (Opening your browser console might give you a hint on the error.)")},
});
}
} else {