always use deepCopy for prefs.values for safety

This commit is contained in:
tophf 2020-11-08 13:29:15 +03:00
parent bc8d8b235c
commit 7d18376cf2
2 changed files with 4 additions and 2 deletions

View File

@ -59,7 +59,7 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, {
parseCss({code}) { parseCss({code}) {
return backgroundWorker.parseMozFormat({code}); return backgroundWorker.parseMozFormat({code});
}, },
getPrefs: () => prefs.values, // will be deepCopy'd by invokeAPI handler getPrefs: () => prefs.values,
setPref: (key, value) => prefs.set(key, value), setPref: (key, value) => prefs.set(key, value),
openEditor, openEditor,

View File

@ -137,7 +137,9 @@ window.INJECTED !== 1 && (() => {
const prefs = window.prefs = { const prefs = window.prefs = {
initializing, initializing,
defaults, defaults,
values, get values() {
return deepCopy(values);
},
get(key) { get(key) {
return isKnown(key) && values[key]; return isKnown(key) && values[key];
}, },