[FIX] web_pwa_oca : do not raise an error if service workers is disabled (only log). Otherwise, odoo is unavailable in private mode with Firefox Browser

This commit is contained in:
Sylvain LE GAL
2020-12-11 11:28:52 +01:00
parent 4a293d8d12
commit a2e801a440
2 changed files with 7 additions and 4 deletions

View File

@@ -33,3 +33,4 @@
doesn't send the cookie and web manifest returns 404.
* Evaluate to support 'require' system.
* Firefox can't detect 'standalone' mode. See https://bugzilla.mozilla.org/show_bug.cgi?id=1285858
* Firefox disable service worker in private mode. See https://bugzilla.mozilla.org/show_bug.cgi?id=1601916

View File

@@ -17,11 +17,13 @@ odoo.define("web_pwa_oca.PWAManager", function (require) {
init: function () {
this._super.apply(this, arguments);
if (!('serviceWorker' in navigator)) {
throw new Error(
_t("Service workers are not supported! Maybe you are not using HTTPS?"));
console.error(
_t("Service workers are not supported! Maybe you are not using HTTPS or you work in private mode."));
}
else {
this._service_worker = navigator.serviceWorker;
this.registerServiceWorker('/service-worker.js');
}
this._service_worker = navigator.serviceWorker;
this.registerServiceWorker('/service-worker.js');
},
/**