Skip to content

Commit

Permalink
Merge pull request #2 from legalsylvain/12.0-FIX-web_pwa_oca-no-error…
Browse files Browse the repository at this point in the history
…-raised-firefox-private-mode

[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
  • Loading branch information
pedrobaeza authored Dec 11, 2020
2 parents 4a293d8 + a2e801a commit 191a6e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions web_pwa_oca/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions web_pwa_oca/static/src/js/pwa_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
},

/**
Expand Down

0 comments on commit 191a6e0

Please sign in to comment.