mpopp75 / cookie-sweep

WebExtension to clear all cookies except for defined domains.
MIT License
3 stars 1 forks source link

[Feature request]: autoremove on exit #7

Open lgbaldoni opened 6 years ago

lgbaldoni commented 6 years ago

Would it be possible to add an option to trigger a sweep exiting the browser? This way one would always start with a clean slate.

dry013 commented 6 years ago

Sweep on startup or shutdown would make the add-on much more useful. I generally don't care about cleaning cookies during a session, but I want to start clean with only those I've white-listed each time.

joey04 commented 6 years ago

I like the simple efficiency of this extension, which does everything I need except for auto-delete at startup or shutdown.

So I modified it to always auto-delete at startup. (Several other cookie extensions do this too, so it may not be feasible to do so at shutdown for WebExtensions, like it was with legacy.)

All that I needed to do was add a clearCookies() call at the end of background.js. But this had the drawback of auto-deleting every time the Options page was opened (which also loads the JS file for the clear now button) so I removed that button and the associated options JS function.

(This is not an AMO-worthy solution, but it's really all I need. I'm the opposite use case of all the big cookie extensions that are for keeping the browser open 24/7 with a million tabs. Rather, I close it when I'm done and can have many sessions throughout a given day. That's why auto-deleting at startup or shutdown is essential to me, while preserving cookies for several domains.)

So thanks, @mpopp75, for writing quality code that did all the tricky bits with a nice options interface and helpful console logging. (To be honest, I removed the logging now that it's only on startup because it's not visible anymore. But it was helpful for vetting this extension.)

joey04 commented 6 years ago

I decided that I wanted the option to manually do a sweep at anytime, so I figured out how to get the startup sweep to co-exist properly with that.

Here's my fork: https://github.com/joey04/Cookie-Sweep

(Note that it's an unsigned extension. I will not upload it to AMO.)

@mpopp75 -- feel free to use whatever you want from my fork