Closed Bug 1416219 Opened 7 years ago Closed 5 years ago

The extension pages localStorage should not be cleared on privacy.sanitize.sanitizeOnShutdown = true

Categories

(WebExtensions :: Storage, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1313401

People

(Reporter: rpl, Unassigned)

References

Details

Currently, if a user configures the following privacy settings: - Load about:preferences#privacy in a tab - In the History section choose "Firefox will use custom settings for history" - Check “Clear history when Firefox closes” All the extensions localStorage data is dropped when Firefox is closed. The reason is that, when the underlying about:config preference "privacy.sanitize.sanitizeOnShutdown" is enabled, a opClearAll will be executed by the StorageDBThread on exit, and this will currently remove all the data from the sqlite3 DB using a "DELETE FROM webappsstore2": https://searchfox.org/mozilla-central/rev/30ead7d1ae5bf95b8bc0fd67b950cd46ca05e32c/dom/storage/StorageDBThread.cpp#1222-1238
Priority: -- → P2
See Also: → 1313401, 1406675
Blocks: 1313401
(In reply to Luca Greco [:rpl] from comment #0) > - Check “Clear history when Firefox closes” Thanks Luca. What are the settings in this test? I suspect that if you tick everything EXCEPT "cookies", the issue does not occur (this is my exact setup and I do not lose any web extension local storage). If you can confirm that, then the issue can be narrowed down to `privacy.clearOnShutdown.cookies` + web extension local storage.
^^ sorry, I meant IF privacy.sanitize.sanitizeOnShutdown=>true AND privacy.clearOnShutdown.cookies=true
(In reply to Simon Mainey from comment #1) > (In reply to Luca Greco [:rpl] from comment #0) > > - Check “Clear history when Firefox closes” > > Thanks Luca. What are the settings in this test? I suspect that if you tick > everything EXCEPT "cookies", the issue does not occur (this is my exact > setup and I do not lose any web extension local storage). If you can confirm > that, then the issue can be narrowed down to > `privacy.clearOnShutdown.cookies` + web extension local storage. Yes, I confirm that it is related to the combination of both is `privacy.clearOfShutdown.cookies = true` (which is the default) and `privacy.sanitize.sanitizeOnShutdown = true`. If privacy.clearOnShutdown.cookie is set to false, even with privacy.sanitize.sanitizeOnShutdown = true, the localStorage is not cleared (not only for the extensions but for all the web pages as well).
Also to consider: when manually clearing history (ctrl-shift-del) and cookies is checked - the pref for this is `privacy.cpd.cookies` The "clear all history" dialog options mirror the preferences UI, and I would assume that eventually they use the same code for deciding what and how to clear. Just want to make sure it's not missed
(In reply to Simon Mainey from comment #4) > Also to consider: when manually clearing history (ctrl-shift-del) and > cookies is checked - the pref for this is `privacy.cpd.cookies` > > The "clear all history" dialog options mirror the preferences UI, and I > would assume that eventually they use the same code for deciding what and > how to clear. Just want to make sure it's not missed Thanks Simon! There is definitely an additional scenario in that dialog, to be precise when "Offline WebSites Data" is selected in the "Clear Recent History..." dialog (which corresponds to privacy.cpd.offlineApps) the extensions localStorage data is going to be dropped (by the same opClearAll that it is executed in the scenario described by this issue): - https://searchfox.org/mozilla-central/rev/30ead7d1ae5bf95b8bc0fd67b950cd46ca05e32c/browser/base/content/sanitize.js#289-290,296-297 - https://searchfox.org/mozilla-central/rev/30ead7d1ae5bf95b8bc0fd67b950cd46ca05e32c/dom/storage/StorageObserver.cpp#316,333,336
^^ just to clarify: Offline Website Data = indexedDB = profile/storage/default Clearing OWD manually and on close does not remove any extension IDB entries (FF56) - eg I have uMatrix and uBlock Origin IDB moz-extension directories - I do this all the time: as I said my "clear on exit" settings are everything but cookies - and I set the same for manual for time range everything and I run that frequently as well). It also does not remove any extension local storage that I know of - eg my Stylus and Violentmonkey storage is not affected There WAS an issue where the time range produced different results - but that was fixed. I'm not a coder :-( .. are you saying clearing OWD manually can clear extension localStorage? Because I cannot produce that (when I use time range "everything")
Component: WebExtensions: General → WebExtensions: Storage
A little more light on the subject. This requires the Storage API to be enabled. FF56 has the two prefs at false, FF57 flipped them to true ( see Bug 1399398 ). The prefs are dom.storageManager.enabled and browser.storageManager.enabled. Hence I did not replicate in 56 as per last comment So the real problem is - If clear on shutdown is enabled and clearing OWD is checked (same when done manually in Clear Recent History), AND Storage API is enabled, then Web Extension local storage etc is cleared
Product: Toolkit → WebExtensions
Though it does not appear the case but wondering nonetheless whether perhaps the patch for bug #1286798 would eventually also resolve this one? Afaik Chrome retains the localStroage content for addons and only purges web page content. As it is right now it is rather tedious to restore WE settings retained in localStroge after each (re)start of the browser.
No longer blocks: 1313401
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.