Restore incognito check before storage

This commit is contained in:
Oliver Blanthorn 2022-05-24 14:19:34 +02:00
parent fc32cc8e33
commit a5ee7f6c00
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3

View file

@ -102,6 +102,13 @@ const state = new Proxy(overlay, {
// Persist "sets" to storage in the background for some keys // Persist "sets" to storage in the background for some keys
if (PERSISTENT_KEYS.includes(property)) { if (PERSISTENT_KEYS.includes(property)) {
// Ensure we don't accidentally store anything sensitive
if (browser.extension.inIncognitoContext) {
console.error(
"Attempted to write to storage in private window.",
)
return false
}
browser.storage.local.set({ browser.storage.local.set({
state: R.pick(PERSISTENT_KEYS, target), state: R.pick(PERSISTENT_KEYS, target),
} as any) } as any)