FF: when not dom.storage.enabled use dummies
This commit is contained in:
parent
777fc06834
commit
cd6bcc6511
|
@ -18,7 +18,7 @@ var updater = {
|
||||||
ERROR_MD5: 'error: MD5 is invalid',
|
ERROR_MD5: 'error: MD5 is invalid',
|
||||||
ERROR_JSON: 'error: JSON is invalid',
|
ERROR_JSON: 'error: JSON is invalid',
|
||||||
|
|
||||||
lastUpdateTime: parseInt(tryCatch(() => localStorage.lastUpdateTime)) || Date.now(),
|
lastUpdateTime: parseInt(localStorage.lastUpdateTime) || Date.now(),
|
||||||
|
|
||||||
checkAllStyles({observer = () => {}, save = true, ignoreDigest} = {}) {
|
checkAllStyles({observer = () => {}, save = true, ignoreDigest} = {}) {
|
||||||
updater.resetInterval();
|
updater.resetInterval();
|
||||||
|
|
|
@ -57,6 +57,13 @@ if (!BG || BG !== window) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const FIREFOX_NO_DOM_STORAGE = FIREFOX && !tryCatch(() => localStorage);
|
||||||
|
if (FIREFOX_NO_DOM_STORAGE) {
|
||||||
|
// may be disabled via dom.storage.enabled
|
||||||
|
Object.defineProperty(window, 'localStorage', {value: {}});
|
||||||
|
Object.defineProperty(window, 'sessionStorage', {value: {}});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function notifyAllTabs(msg) {
|
function notifyAllTabs(msg) {
|
||||||
const originalMessage = msg;
|
const originalMessage = msg;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* global prefs: true, contextMenus */
|
/* global prefs: true, contextMenus, FIREFOX_NO_DOM_STORAGE */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// eslint-disable-next-line no-var
|
// eslint-disable-next-line no-var
|
||||||
|
@ -75,9 +75,6 @@ var prefs = new function Prefs() {
|
||||||
specific: new Map(),
|
specific: new Map(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// FF may think localStorage is a cookie or that it's not secure
|
|
||||||
const localStorage = tryCatch(() => window.localStorage) ? window.localStorage : {};
|
|
||||||
|
|
||||||
// coalesce multiple pref changes in broadcast
|
// coalesce multiple pref changes in broadcast
|
||||||
let broadcastPrefs = {};
|
let broadcastPrefs = {};
|
||||||
|
|
||||||
|
@ -184,6 +181,8 @@ var prefs = new function Prefs() {
|
||||||
value = tryJSONparse(value) || defaultValue;
|
value = tryJSONparse(value) || defaultValue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (FIREFOX_NO_DOM_STORAGE && BG) {
|
||||||
|
value = BG.localStorage[key] || defaultValue;
|
||||||
} else {
|
} else {
|
||||||
value = defaultValue;
|
value = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user