Closed Bug 862465 Opened 12 years ago Closed 6 years ago

"Forget about this Site" clears all AppCache

Categories

(Toolkit :: Data Sanitization, defect, P3)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Gavin, Assigned: ns19041997, Mentored)

References

(Blocks 2 open bugs)

Details

Depends on: 1237782
Blocks: storage-v2
Priority: -- → P3

Another example of how to clear this can be found here:

https://searchfox.org/mozilla-central/rev/c21d6620d384dfb13ede6054015da05a6353b899/browser/modules/SiteDataManager.jsm#192-220
https://searchfox.org/mozilla-central/rev/c21d6620d384dfb13ede6054015da05a6353b899/browser/modules/SiteDataManager.jsm#314-318

However, I wonder if it might be enough to use asyncDoomURI here:

https://searchfox.org/mozilla-central/source/netwerk/cache2/nsICacheStorage.idl#129-130

Honza, can you confirm that something like

let appCacheStorage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, null);
appCacheStorage.asyncDoomURI(uri, callback);

would work for clearing AppCache only for a certain host?

Thanks!

Flags: needinfo?(honzab.moz)

(In reply to Johann Hofmann [:johannh] from comment #1)

However, I wonder if it might be enough to use asyncDoomURI here:

https://searchfox.org/mozilla-central/source/netwerk/cache2/nsICacheStorage.idl#129-130

Honza, can you confirm that something like

let appCacheStorage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, null);
appCacheStorage.asyncDoomURI(uri, callback);

would work for clearing AppCache only for a certain host?

Thanks!

"Asynchronously removes an entry belonging to the URI" is the comment for asyncDoomURI. It says nothing about origin or scoping. It only removes a single entry in 1-1 relation with the URI.

No, that is not the way to clear origin.

Flags: needinfo?(honzab.moz)

Hi,
I would like to work on this!
Could this be assigned to me?
Thanks!

Sure, thank you!

Assignee: nobody → ns19041997
Status: NEW → ASSIGNED
Mentor: jhofmann

(In reply to Neha from comment #3)

Hi,
I would like to work on this!
Could this be assigned to me?
Thanks!

Sure, thanks for jumping on this one. I can try to find some time to help you as I'm the owner of appcache. Just let you know that:

  1. this bug may not be that simple to fix because there may be (I would have to look) no API or even an unexposed mechanism to clear appcache per origin
  2. appcache treatment is only to fix security, serious stability or functionality issue, but nothing more
Mentor: honzab.moz

Hello Johann, Honza,
how can I check whether the cache has been cleared or not?
So I know if the changes I make are working.
Thanks!

Load http://webdbg.com/test/appcache/. In the (local) part of the profile you will see a directory called OfflineCache. Some time after you have visited that page there should be subdirs in it. After delete, they should be gone. You can also examine the index.sqlite file with sqlite3 shell. select * from moz_cache_groups; should show results when there is something in appcache, and nothing when it's been cleared.

OK, a better (working, actually) app can be found here: https://archive.jonathanstark.com/labs/app-cache-2b/

I also wrote on IRC that we test AppCache in automated tests like this: https://searchfox.org/mozilla-central/rev/4763b8d576ce52625d245d1ab6d9404ea025b026/browser/components/preferences/in-content/tests/siteData/browser_clearSiteData.js#12-14

Not super great, but the best I can think of.

Hi Johann, Honza!

I visited https://archive.jonathanstark.com/labs/app-cache-2b/ and then queried for select * from moz_cache_groups; which returned the following:
https://archive.jonathanstark.com/labs/app-cache-2b/demo.manifest#|https%3A//archive.jonathanstark.com/labs/app-cache-2b/demo.manifest%23|0000001553244367|0|1553244369

Then I did "Forget about this site" from the history and ran the query again. The query returns empty and there are folders with name - 1,2,4,6,A,D with subdirs that are also emptied.

I think that the issue has already been fixed. I ran this experiment on these two versions of Firefox with same results. Could you please review if I am missing something!

  1. Nightly 67.0a1 (2019-02-25) (64-bit)
  2. Quantum 65.0.1 (64-bit)

Thanks!

Just for completeness, have you checked that before you do "forget about this site" the content is present? (the sql query returns something and there are files in the subdirectories)

Yes, the subdirs contain some images and files and the sql query returns results as described in comment#10. On doing 'forget site', both the subdirs and sql query are empty!

Thanks!

Could I ask you for one more test? If you do "forget about this site" for a completely DIFFERENT domain, does it affect the stored appcache data for the domain you have tested with in comment 10?

Thanks.

Yes, if we do "forget about this site" for any domain other than https://archive.jonathanstark.com/labs/app-cache-2b/, then also the subdirs are emptied and sql query returns no results.

So I guess the issue now is not that "forget about this site" doesn't clear appcache, rather it clears all appcache? If yes, then let's close this one and open a new issue. I would be happy to take a look at what is causing this.

Thanks!

I strongly discourage against it. This bug was about ensuring that we delete the data for the the domain, which we do. If we also delete all other appcaches, then it's a bug, yes, but if you file it, it will be given P5 and forgotten about.

We don't fix ANY appcache bugs unless they are stability, critical or major functionality issues, which this bug would be neither of. Appcache is considered an obsolete webtech and we encourage people to use service workers instead.

Closing this as WFM and many thanks for spending time on testing this! Much appreciated!

Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME

Ah, sorry, there's been a misunderstanding here. After some more recent changes to improve robustness of clearing site data "Forget About this Site" indeed does delete AppCache, because it hits this function: https://searchfox.org/mozilla-central/rev/2c912888e3b7ae4baf161d98d7a01434f31830aa/toolkit/components/cleardata/ClearDataService.jsm#285

Now, that is also not really what it's supposed to do, because that deletes all AppCache, not just the one from the host that Forget about this Site passes. I should have clarified that that is what we want to fix in the bug title.

Considering that we'd like to get rid of AppCache, it's probably fine to leave this closed, though.

Resolution: WORKSFORME → WONTFIX
Summary: "Forget about this Site" doesn't clear appcache → "Forget about this Site" clears all AppCache

Thanks for the clarification. Seconded.

Depends on: 1619673
You need to log in before you can comment on or make changes to this bug.