From f09631f36a2a081ec310d1609dbdbd140f9daedd Mon Sep 17 00:00:00 2001 From: Maykonn Date: Tue, 19 Jun 2018 10:25:17 -0300 Subject: [PATCH] Improved for Mozilla Browsers --- BrowsingModeDetector.js | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/BrowsingModeDetector.js b/BrowsingModeDetector.js index abcaf24..45442d2 100644 --- a/BrowsingModeDetector.js +++ b/BrowsingModeDetector.js @@ -209,36 +209,11 @@ var MozillaBrowser = function (BrowsingModeDetector) { this.BrowsingModeDetector = BrowsingModeDetector; this.detectBrowsingMode = function () { - var db; - var self = this; - - var callbackWhenIndexedDBWorking = function (e) { - if (typeof self.BrowsingModeDetector.getBrowsingMode() === 'undefined') { - self.BrowsingModeDetector.retry( - function () { - return db.readyState === 'done'; - }, - function (isTimeout) { - if (isTimeout) { - return callbackWhenIndexedDBNotWorking(e); - } - - if (db.result) { - self.BrowsingModeDetector.setBrowsingInNormalMode(); - } - } - ); - } - }; - - var callbackWhenIndexedDBNotWorking = function (e) { - // On Firefox ESR versions, actually IndexedDB don't works. - self.BrowsingModeDetector.setBrowsingInIncognitoMode(); - }; - - db = indexedDB.open("i"); - db.onsuccess = callbackWhenIndexedDBWorking; - db.onerror = callbackWhenIndexedDBNotWorking; + if (navigator.serviceWorker) { + this.BrowsingModeDetector.setBrowsingInNormalMode(); + } else { + this.BrowsingModeDetector.setBrowsingInIncognitoMode(); + } }; return this;