Open Bug 1950152 Opened 2 days ago Updated 2 days ago

Cache clearOriginAttributes and ClearOrigin APIs are ambiguous

Categories

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

task

Tracking

()

People

(Reporter: edgul, Unassigned)

References

Details

(Keywords: good-first-bug, Whiteboard: [necko-triaged][necko-priority-next])

  1. clearOriginAttributes.
    DoomStorageEntries calls with empty origin and Empty origin will be removed. So it looks like the intention of this function is to clear entries of all origins with matching OA. Maybe the name should be something like clearAllOriginsByOriginAttribute?

  2. ClearOrigin.
    We pull the origin from the principal and clearOriginInternal passes that origin to EvictByContext, and we also appear to respect the principal's originAttributes when clearing entries (via nsLoadContextInfo). So clearOrigin name and it's comment could be a little better. Perhaps a comment that says: Evict any cache entry having the same origin and OriginAttributes of aPrincipal and rename the function name to be clearByPrincipal?

As kind of an edge case though, I'm not yet clear on what happens if this function is triggered from a url that doesn't have a hostname, the inner functions appear to return null string for origin. Maybe this can make it's way into EvictByContext, where passing an empty origin would clear all origins with matching OA (similar to above)? But maybe the explicit null string prevents that?

Severity: -- → N/A
Keywords: good-first-bug
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-next]
You need to log in before you can comment on or make changes to this bug.