Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8bc8f4ca4c47be01c6b6e166763ef55f57c8a800
      
https://github.com/WebKit/WebKit/commit/8bc8f4ca4c47be01c6b6e166763ef55f57c8a800
  Author: Frédéric Wang Nélar <[email protected]>
  Date:   2026-07-28 (Tue, 28 Jul 2026)

  Changed paths:
    M Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp
    M Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h

  Log Message:
  -----------
  [regression] Storage::traverse(const String& type, const String& partition, 
...) is broken
https://bugs.webkit.org/show_bug.cgi?id=315416
rdar://183308318

Reviewed by Chris Dumez.

https://github.com/WebKit/WebKit/pull/9665 introduced a new version of
Storage::traverse that accepts a cache partition argument to traverse
only the cache entries corresponding to that partition. This is done by
passing the subdirectory corresponding to that partition on the disk
as a rootPath argument to Storage::traverseWithinRootPath and that
ends up using that subdirectory as a recordsPath argument for
Storage::traverseRecordsFiles. However, that latter function actually
expects recordsPath to be the root of Records files, since it
traverses all the subdirectories as if they were cache partitions.

Currently, this code is only hit by the version of Cache::traverse that
acccepts a partition argument, which is itself only used by
NetworkProcess::deleteWebsiteDataForOrigin and finally
by NetworkResourceLoader::processClearSiteDataHeader. So that regression
from 2023 only affects Clear-Site-Data: "cache".

This bug can be manually tested with some simple steps from the command
line: https://bugs.webkit.org/show_bug.cgi?id=315416#c1. This method to
traverse cache entries per-partition is also critically used to
implement Compression Dictionary Transport and is covered by many WPT
tests from fetch/compression-dictionary. However, we don't implement
this yet, see bug 295249.

No new tests, verified manually and covered by WPT tests.

* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp:
(WebKit::NetworkCache::traversePartitionFiles): New traverse function that 
accepts a partition path as an argument.
(WebKit::NetworkCache::traverseRecordsFiles): New function that accepts the 
root of Records as an argument and calls traversePartitionFiles on all 
subdirectories.
(WebKit::NetworkCache::Storage::traverseWithinRootPath): Deleted.
(WebKit::NetworkCache::Storage::traverseInternal): Replace 
traverseWithinRootPath, using a partition name instead, and call either 
traverseRecordsFiles (if partition name is empty) or traversePartitionFiles on 
the specific partition folder.
(WebKit::NetworkCache::Storage::traverse): Calls traverseWithinRootPath with a 
partion name (empty or not depending on the version).
* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h: Replace 
traverseWithinRootPath with traverseInternal.

Canonical link: https://commits.webkit.org/318124@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to