Merge pull request #2019 from jitsi/local_storage_error

fix(JitsiLocalStorage): Handle local storage error
This commit is contained in:
virtuacoplenny 2017-09-26 15:10:59 -07:00 committed by GitHub
commit 98aa0b6ad9
1 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,7 @@
import Logger from 'jitsi-meet-logger';
const logger = Logger.getLogger(__filename);
/** /**
* Dummy implementation of Storage interface with empty methods. * Dummy implementation of Storage interface with empty methods.
*/ */
@ -26,8 +30,15 @@ class JitsiLocalStorage extends DummyLocalStorage {
* @constructor * @constructor
* @param {Storage} storage browser's local storage object. * @param {Storage} storage browser's local storage object.
*/ */
constructor(storage) { constructor() {
super(); super();
let storage;
try {
storage = window.localStorage;
} catch (error) {
logger.error(error);
}
this.storage = storage || new DummyLocalStorage(); this.storage = storage || new DummyLocalStorage();
} }
@ -61,4 +72,4 @@ class JitsiLocalStorage extends DummyLocalStorage {
} }
} }
export default new JitsiLocalStorage(window.localStorage); export default new JitsiLocalStorage();