[Bug] Manual clean doesn't work if window get closed
andreapx opened this issue · 4 comments
Acknowledgements
- I acknowledge that I have read the above items
Describe the bug
If I click on "Clean all for this domain" and then I close the extension popup, the clean doesn't go through.
To Reproduce
Open the extension popup, click on "Clean all for this domain", click on the webpage: the extension popup gets closed and the cookies are not deleted
Expected Behavior
The cookies are deleted!
Screenshots
No response
System Info - Operating System (OS)
Windows 1o Pro 20H2
System Info - Browser Info
Firefox 111.0 (it was the same with the previous versions)
System Info - CookieAutoDelete Version
3.8.2
Additional Context
No response
There are a couple items in play here that may have caused this.
- #807
- Manual clean (which are the buttons that specify exactly what to clean for that domain) does not add an entry to the list of cleaned items as that is currently just for automated cleanups (and only the buttons for 'clean' and 'clean, include open tabs' buttons. Only does a notification popup.
We can probably revisit this issue if it still persists once we fix the main issue above.
2. Manual clean (which are the buttons that specify exactly what to clean for that domain) does not add an entry to the list of cleaned items as that is currently just for automated cleanups (and only the buttons for 'clean' and 'clean, include open tabs' buttons. Only does a notification popup.
I don't know if I didn't understand your reply (sorry about it!) or if you misunderstood mine: the cookies do get cleaned if I keep the popup open, if I click on the webpage and the popup gets closed, the cookies don't get deleted.
- Manual clean (which are the buttons that specify exactly what to clean for that domain) does not add an entry to the list of cleaned items as that is currently just for automated cleanups (and only the buttons for 'clean' and 'clean, include open tabs' buttons. Only does a notification popup.
I don't know if I didn't understand your reply (sorry about it!) or if you misunderstood mine: the cookies do get cleaned if I keep the popup open, if I click on the webpage and the popup gets closed, the cookies don't get deleted.
Most likely my misunderstanding, manual cleanup does not run in the background (while most of the cleaning functions are contained in the background, but the one calling those functions are not), and some scripts related to manual cleanup only gets loaded when the popup is loaded, thus when the popup is closed, those scripts and/or variables stop existing/working.
After taking a deeper look, the process follows a specific order, attempting to clean up the other browsing site data first (cache, indexeddb, etc, one after the other, then cookies after that. This specific cookie cleanup function relies on the tab object that the popup queries for, which is only queried by the popup and thus only available when the popup is still active (because regular automatic cleaning does not need to query any tabs or find the active tab).
Long story short, the variables containing the active tab and its info is only available when the popup is active, and is not stored in the background. This variable is needed for manual cleanup, so the popup must stay active for the whole manual cleanup process.
The fix for this would need to store extra stuff in the background (thus take up more memory) and rework the process so that it actually runs in the background. It can be done, but the time I currently have is minimal. I'm more than happy to take pull requests for this if somebody wants to give it a shot.
Got it, thanks for the explanation!
I'm more than happy to take pull requests for this if somebody wants to give it a shot.
Unfortunately I'm no developer...sorry.