Rob--W/cookie-manager

preserving cookies

rbro opened this issue · 7 comments

rbro commented

Thanks for a nice extension. Prior to Firefox 57, I used an extension called biscuit that supported preserving certain cookies, so when you cleared your browser history, you could delete all your cookies except certain ones that you flagged - https://addons.mozilla.org/en-US/firefox/addon/biscuit-220876. I don't know what's involved in supporting that or even if it's possible with the WebExtensions API, but I just wanted to see if it was possible to add into Cookie Manager? Thanks for your help.

I added a new feature to 1.4 called "whitelist". It can support your workflow as follows:

First, you need to add all cookies that you want to preserve to the whitelist in the Cookie Manager.

Then, when you want to clean cookies:

  1. Open the Cookie Manager
  2. Change the filter "whitelist = any" to "whitelist = no"
  3. Click the search button
  4. Click select all.
  5. Click on "Remove selected" and confirm.

If you forget step 2, then the whitelisted cookies appear in the search result. But the cookie manager will refuse to delete the whiteisted cookies (and show a prompt where you can unlock the ability to modify whitelisted cookies if you wish).

Please give it a try and let me know whether this solves your use case.

(the update also includes an import/export feature, you can also use that to create a backup of your cookies before experimentation.)

rbro commented

This is great, thanks so much for implementing it. One question - and this may not be possible due to how WebExtensions work - but using that biscuit extension I mentioned above, I was able to go to History - Clear Recent History, and even though I deleted all my cookies, biscuit was able to capture that event and either not delete the whitelisted cookies, or perhaps it let Firefox delete them and then restored them after (I'm not sure which). Do you know of any way to hook into that event in Firefox?

There is the cookies.onChanged event, but I have never used it (and don't know if it is reliable / bug-free): https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/cookies/onChanged

I am willing to introduce an optional feature to automatically restore deleted cookies. I just need to be careful to not end in an infinite loop when managing cookies through the cookie manager. What is your expectation about expired cookies? What about an edited cookie (e.g. a different value)? When do you want to automatically restore a cookie?

rbro commented

Thanks, that's interesting they have a cookies.onChanged event, so maybe it could work.

I'm thinking that expired cookies should not be restored even if they are marked to be whitelisted. Edited cookies should keep their current value when restored. For when to automatically restore a cookie, I was thinking either prevent the browser from deleting a whitelisted cookie, or if that's not possible, then automatically restore the whitelisted cookie right after it's been deleted when you go to History - Clear Recent History.

@Rob--W,
This would be a great feature if it could be implemented. Actually, reading this thread/issue made me think of a few different features that would be awesome, but perhaps they would have to be long-term goals for the project.

Have you had any success trying to achieve what you and @rbro have discussed here?

Thanks,

Doug®

@Grossdm I haven't worked on the cookie manager lately. The UI is still not as good as I'd like.

@Rob--W,
I understand limited time for everything in your life.
Take care of yourself, and perhaps put this at least somewhere on the to-do list.

Thanks,
Doug®