Closed Bug 1819147 Opened 2 years ago Closed 4 months ago

Services.cache2.clearOriginAttributes() does not clear all cache entries of specified userContext

Categories

(Core :: Networking: Cache, defect, P2)

Firefox 110
defect

Tracking

()

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: max, Assigned: edgul)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file, 2 obsolete files)

Steps to reproduce:

  1. Navigate to http://example.com/
  2. go to about:cache
  3. observe http://example.com/ entry with O^partitionKey=%28http%2Cexample.com%29, as a key. (and more)
  4. Open Browser Toolbox (needs to be enabled in DevTools first)
  5. Execute Services.cache2.clearOriginAttributes(JSON.stringify({ userContextId:0 }))
  6. go to about:cache again (make sure to reload)

Actual results:

Observe no entries which are about http://example.com

Expected results:

http://example.com/favicon.ico
and
http://example.com/
are still there.

Summary: Service.cache2.clearOriginAttributes() does not clear all cache entries of specified userContext → Services.cache2.clearOriginAttributes() does not clear all cache entries of specified userContext

The Bugbug bot thinks this bug should belong to the 'Core::Networking: Cache' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Networking: Cache
Product: Firefox → Core

In CacheFileIOManager::EvictByContextInternal the function Equals() gets called which uses OriginAttributes== where the mPartitionKey gets strictly compared.

In our scenario the cache entry has a mPartitionKey of "(http,example.com)" and we compare it against "".

From my understanding when calling this method, mPartitionKey should not be compared against.

Hi Ed,

Could you take this? I think we need to add another EqualsIgnoringFPD method here that does:

https://searchfox.org/mozilla-central/rev/00ea1649b59d5f427979e2d6ba42be96f62d6e82/netwerk/base/nsILoadContextInfo.idl#62-67

  bool EqualsIgnoringFPD(nsILoadContextInfo *aOther)
  {
    return IsAnonymous() == aOther->IsAnonymous() &&
           OriginAttributesPtr()->EqualsIgnoringFPD(*aOther->OriginAttributesPtr())
  }
%}

Then change CacheFileIOManager::EvictByContextInternal to call EqualsIgnoringFPD.

A test would be nice too I suppose.

Assignee: nobody → edgul
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]

Sorry for the delay on this. I'd like to confirm the desired behavior on this, the actual/expected description seems like it might be backwards?:

Actual results:
Observe no entries which are about http://example.com
Expected results:
http://example.com/favicon.ico
and
http://example.com/
are still there.

Flags: needinfo?(max)

Noting the correction:

Actual results:
http://example.com/favicon.ico
and
http://example.com/
are still there.

Expected results:
Observe no entries which are about http://example.com
Flags: needinfo?(max)
Attachment #9406822 - Attachment is obsolete: true
Attachment #9406821 - Attachment is obsolete: true
Pushed by eguloien@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a5acfd034c3f Fixed clearOriginAttributes not clearing all cache entries specificed with userContext r=valentin,necko-reviewers
Regressions: 1902579
Status: UNCONFIRMED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: