Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache is not cleared on Firefox #13

Open
boinker opened this issue Feb 7, 2019 · 18 comments
Open

Cache is not cleared on Firefox #13

boinker opened this issue Feb 7, 2019 · 18 comments
Labels

Comments

@boinker
Copy link

boinker commented Feb 7, 2019

No description provided.

@dessant
Copy link
Owner

dessant commented Feb 7, 2019

Please share more details.

@boinker
Copy link
Author

boinker commented Feb 7, 2019

After clicking Clear Browsing Data menu button I go to Options/Privacy & Security/Cookies and Site Data. There it says that "Your stored cookies, site data and cache are currently using 3.5 MB of disk space". I then click Manage Data button and it says that www.united.com is using 3.5 MB of storage and google.com has 2 cookies. I have checked all boxes in the Clear Browsing Data options. Clear Browsing Data reports that "...successfully cleared."

So Clear Browsing Data does not clear everything causing me to have to go into Firefox Options/Privacy & Security/Cookies and Site Data and click on the "Clear Data..." button. Then after a refresh Firefox reports that "Your stored cookies, site data and cache are currently using 0 bytes of disk space."

Please update Clear Browsing Data so that after running it Firefox reports "Your stored cookies, site data and cache are currently using 0 bytes of disk space."

Thank you

@dessant
Copy link
Owner

dessant commented Feb 7, 2019

What version of Firefox are you using and which operating system? The extension is using browser APIs to clear the data and it works as expected for others. It is possible that you are seeing a browser bug.

@boinker
Copy link
Author

boinker commented Feb 7, 2019

The www.united.com storage used by Firefox is created when I go to united.com and put in my confirmation number and last name to check on my flight. Some sort of persistent data. I don't know. You are the expert. I don't know about the google.com cookies remaining after clicking Clear Browsing Data. I am running Firefox Quantum 65.0 (64-bit) on Win 10 Pro. Firefox says it's up to date.

@dessant
Copy link
Owner

dessant commented Feb 7, 2019

On my part all data is cleared with the same browser, have you refreshed the about:preferences#privacy page before checking Manage Data again?

@dessant
Copy link
Owner

dessant commented Feb 7, 2019

It's also possible that sites make requests and store data right after you clear the data, so make sure to close other tabs before further tests.

@boinker
Copy link
Author

boinker commented Feb 7, 2019

I refresh the 'about:preferences#privacy' page to see if the clear worked. It does not. I tested it with only one Firefox tab open and that would be the 'about:preferences#privacy' page. Currently only the www.united.com site is using 3.5 MB last used 43 minutes ago.

@dessant
Copy link
Owner

dessant commented Feb 7, 2019

I have reproduced the issue with a fresh Firefox profile using their service worker demo. Files cached by service workers are not cleared by the extension API.

According to the docs serviceWorkers clears the data cached by service workers, but it seems the code below unregisters workers without clearing the data.

// extension background page
browser.browsingData.remove({}, {serviceWorkers: true})

Run this in the web console (Ctrl+Shift+K) of the page that registered the service worker, it will list the keys of the cache:

window.caches.keys().then(function(keyList) {
  console.log(keyList)
});

This API works as expected in Chrome and the data is cleared.

The bug can be used to track users. The only workaround I have found so far is to disable service workers, visit about:config?filter=dom.serviceWorkers.enabled and set the value to false.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browsingData/remove

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browsingData/DataTypeSet

https://github.com/mozilla/gecko-dev/blob/ca776030e53ee395aa8c9014243caba9abacc184/browser/components/extensions/parent/ext-browsingData.js#L234

@dessant
Copy link
Owner

dessant commented Feb 8, 2019

Disabling service workers only works if the caching is done from a service worker, but pages can access the Cache API too, so clearing the data using Firefox options or disabling the cache entirely are the only workarounds.

Save the user id:

window.caches.open('userid');

Get the user id on future visits:

window.caches.keys().then(keys => console.log(keys[0]));

@dessant
Copy link
Owner

dessant commented Feb 8, 2019

https://bugzilla.mozilla.org/show_bug.cgi?id=1526246

@boinker
Copy link
Author

boinker commented Feb 9, 2019

Thank you for all of your good work. I wonder if Mozilla will do anything. We'll see.

@dessant
Copy link
Owner

dessant commented Feb 9, 2019

Thanks! I enjoyed exploring the bug. 😋

I think they'll fix it at some point, though keep in mind that the browsingData API in Firefox will still remain a minefield. Some of the bugs are listed in the description of the extension on AMO. All of that works as expected in Chrome.

@dessant
Copy link
Owner

dessant commented May 12, 2019

I wrote a blog post about the issues discovered in the Firefox browsingData API.

https://armin.dev/blog/2019/03/firefox-extensions-browsing-data-security/

@dessant dessant changed the title Clear Browsing Data does not clear all Not all data is cleared on Firefox May 16, 2019
@nadesco
Copy link

nadesco commented May 27, 2019

visit about:config?filter=dom.serviceWorkers.enabled and set the value to false

Thanks for that. Clicking on Clear All Browsing Data previously set Cookies to '0' but Storage was still showing sites like youtube leaving KBs of data. I tried the United page and it showed 3.2MBs of data remaining in Storage when Cookies showed zero. In Preferences all boxes except browsing history, download history and saved p/words were checked. (Mac 10.14.5, Firefox 67.0)

With dom.serviceWorkers.enabled set to False the remaining data is now deleted. :)

@boinker
Copy link
Author

boinker commented May 27, 2019

I tried setting dom.serviceWorkers.enabled to false but data (e.g. youtube) remained after clicking the 'Clear Browsing Data' add-on button. Windows 10, Firefox 67.0 (64-bit).

@dessant
Copy link
Owner

dessant commented May 27, 2019

I've looked further and there is a config option for disabling the Cache API, without disabling the internal cache entirely. Setting about:config?filter=dom.caches.enabled to false prevents storing data with the Cache API, though it may break sites that depend on it.

@Taurean75

This comment has been minimized.

@dessant

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants