Merge pull request #2019 from jitsi/local_storage_error
fix(JitsiLocalStorage): Handle local storage error
This commit is contained in:
commit
98aa0b6ad9
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue