fix(JitsiLocalStorage): Handle local storage error

This commit is contained in:
hristoterezov 2017-09-26 16:14:07 -05:00
parent eae3bead87
commit 01031ff0a7
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.
*/
@ -26,8 +30,15 @@ class JitsiLocalStorage extends DummyLocalStorage {
* @constructor
* @param {Storage} storage browser's local storage object.
*/
constructor(storage) {
constructor() {
super();
let storage;
try {
storage = window.localStorage;
} catch (error) {
logger.error(error);
}
this.storage = storage || new DummyLocalStorage();
}
@ -61,4 +72,4 @@ class JitsiLocalStorage extends DummyLocalStorage {
}
}
export default new JitsiLocalStorage(window.localStorage);
export default new JitsiLocalStorage();