Lusito / forget-me-not

Make the browser forget website data, except for the data you want to keep.
zlib License
227 stars 25 forks source link

Addon storage is getting deleted #142

Open Joel889 opened 5 years ago

Joel889 commented 5 years ago

Manual cleaning in version 2.0 is erasing this addon's settings: https://addons.mozilla.org/en-US/firefox/addon/referercontrol/

Maybe it's the addon's fault for storing the settings in a weird place, BUT the settings are preserved as long as "cookies + local storage" have the "Apply Rules" (the shield icon) checkbox set. This might reveal a totally different bug, because: 1) Why would "Apply Rules" influence whether an addon's settings are getting cleaned? 2) Why will it preserve the settings if "cookies + local storage" is protected under "Apply Rules"? If anything, it should be the Local Storage setting that is protecting it. Instead, it is only protecting it when cookies + local storage are both checked under the shield column (manual cleanup).

Edit: The same is true for startup clean up. "Apply Rules" will protect the addon's settings, but only if both "Cookies + local storage" are selected.

Lusito commented 5 years ago

First of all, I don't think I've changed anything that would cause this to happen with the new version. So if it really is like this, then it should have happened with 1.x too. Second, at least according to the MDN, the method I use to clear the storage and cookies when not applying rules is not affecting the extensions local storage: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browsingData/RemovalOptions

There is an option to clear extension storages, but that's not supported in Firefox. And even if it somehow did clear localstorage for extensions, then it would affect other extensions as well (including FMN).

So unless the extension stores its settings on the local storage of a website, it should not be affected by FMN cleanup. Since that extension is not open source, it's not easy to read the source code and detect why it would be affected.

Joel889 commented 5 years ago

Some additional information: 1) The addon is storing its setting in webappsstore.sqlite. 2) Firefox's setting "Delete cookies and site data when Firefox is closed" preserves the addon's setting, but is otherwise deleting all cookies, local storage, and indexedDB. 3) This wasn't an issue with version 1.x, but it is possible that I misunderstood that "Apply Rules" means protecting local storage (as opposed to deleting it). 4) Either way, why does it need the checkbox for "cookies + local storage" set under Apply Rules, in order to skip deleting local storage? Shouldn't the "local storage" flag by itself be sufficient?

bendover22 commented 5 years ago

I don't know if my recent issue is the same / closely related to Joel889's. If not, please tell me to move this.

Is there any known reason that updating to v2.2.1 would delete all existing site cookie rules? In Fx 65.0.1 (linux mint 18.1) After updating FMN through the Fx addons manager to v2.2.1, all of my saved rules were gone (maybe 30 - 40 sites / domains).

These were the 2 changes for v2.2.1 listed on AMO: _- Translations have been updated.

Before updating to 2.2.1, all my saved rules were intact & working fine. After updating, I didn't immediately access FMN 2.2.1 settings to change anything for days. I don't think I accessed any sites the same day that FMN updated, that needed FMN cookie control.
What ever FMN 2.2.1 settings that changed (if any) after the update - were default settings. I didn't change any settings or even know there were many more FMN options than the previous version. Not until a few days - I noticed all saved site rules were missing.

At the update time or after, I didn't touch the directory "browser-extension-data", or /{profile}/browser-extension-data/forget-me-not@lusito.info/storage.js file. In Fx profile, the previous FMN version's storage.js had been automatically renamed as: "storage.js.corrupt,"with 0 kb content and a new storage.js was created. I'm not sure what added "corrupt" to the file name. I've never seen that happen until now.

I'm not sure if the next points about file dates can be considered 100% accurate, given some odd addons manager behavior starting w/ Firefox 57 & beyond. Fx addons mgr shows FMN "last updated" = 03/15/2019. The last modified date shown for "storage.js.corrupt" is 03/13/2019, which doesn't make sense, unless it was corrupted / contents deleted - 2 days before the update time (again, not by me).

The new storage.js has last modified date = 03/16/2019, which is plausible, as I started saving new cookie rules to replace the missing ones. AFAIK, no other addons or Fx files showed problems during this time.

Another possibility is an unexpected electricity "blink out" about this time period. I could look in system logs & find the date of unexpected shut down.

The computer / monitor are on an UPS battery backup / surge protector, that worked correctly 1 - 2 weeks ago, but not during the last power blink out.

Lusito commented 5 years ago

Sorry, but no.. nothing has changed that would affect the settings. This sound more like somehow the storage got corrupted or lost by firefox. Maybe the browser crashed while writing the files or your harddisk had an error. Firefox seems to rename the original file when it finds a file is corrupted.

I've never heard this before, so it's probably a rare thing. I can only recommend to use the export feature of FMN to store your rules every once in a while.