Implement listing origins for which CacheStorage is storing data
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Oct 2017 20:31:34 +0000 (20:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Oct 2017 20:31:34 +0000 (20:31 +0000)
commitb0059d53abaa844bedd8138ad2092d02b6907a9b
treefa33811e8f2cf68e896129f40c108d09083fef8b
parent534c81e9ac5c6b884bf7f5b0574968257d611439
Implement listing origins for which CacheStorage is storing data
https://bugs.webkit.org/show_bug.cgi?id=178236

Patch by Youenn Fablet <youenn@apple.com> on 2017-10-13
Reviewed by Chris Dumez.

Source/WebKit:

Cache storage is split on per-origin folders which name is obfuscated through salting.
To retrieve the origin for each folder, an origin file is now stored within each folder.
This file contains the actual origin.

Adding support to get the list of origin by iterating through each folder and
getting the actual origin by reading the content of the 'origin' file.

Adding C API for WebKitTestRunner.

* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::fetchEntries):
(WebKit::CacheStorage::ReadOriginsTaskCounter::create):
(WebKit::CacheStorage::ReadOriginsTaskCounter::~ReadOriginsTaskCounter):
(WebKit::CacheStorage::ReadOriginsTaskCounter::addOrigin):
(WebKit::CacheStorage::ReadOriginsTaskCounter::ReadOriginsTaskCounter):
* NetworkProcess/cache/CacheStorageEngine.h:
* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::cachesOriginFilename):
(WebKit::CacheStorage::Caches::retrieveOriginFromDirectory):
(WebKit::CacheStorage::Caches::Caches):
(WebKit::CacheStorage::Caches::storeOrigin):
(WebKit::CacheStorage::Caches::readOrigin):
(WebKit::CacheStorage::Caches::initialize):
* NetworkProcess/cache/CacheStorageEngineCaches.h:
(WebKit::CacheStorage::Caches::origin const):
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreGetFetchCacheOrigins):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:

Tools:

Adding hasDOMCache API for checking whether origin is storing data through Cache API.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::hasDOMCache):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::FetchCacheOriginsCallbackContext::FetchCacheOriginsCallbackContext):
(WTR::fetchCacheOriginsCallback):
(WTR::TestController::hasDOMCache):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/tests/cache-storage/cache-clearing-origin.https.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/cache-storage/cache-clearing-origin.https.html
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp
Source/WebKit/NetworkProcess/cache/CacheStorageEngine.h
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp