From 6e52ab61828157b13f1cf97301c79b5548373b3c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 22 Jun 2017 15:11:11 +0100 Subject: [PATCH] Fix load failure in firefox when indexedDB is disabled --- src/vector/rageshake.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vector/rageshake.js b/src/vector/rageshake.js index 0138d624..249f1f27 100644 --- a/src/vector/rageshake.js +++ b/src/vector/rageshake.js @@ -410,8 +410,16 @@ module.exports = { } logger = new ConsoleLogger(); logger.monkeyPatch(window.console); - if (window.indexedDB) { - store = new IndexedDBLogStore(window.indexedDB, logger); + + // just *accessing* indexedDB throws an exception in firefox with + // indexeddb disabled. + let indexedDB; + try { + indexedDB = window.indexedDB; + } catch(e) {} + + if (indexedDB) { + store = new IndexedDBLogStore(indexedDB, logger); initPromise = store.connect(); return initPromise; }