WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-175455-20170811103145.patch (text/plain), 112.29 KB, created by
youenn fablet
on 2017-08-11 10:31:47 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2017-08-11 10:31:47 PDT
Size:
112.29 KB
patch
obsolete
>Subversion Revision: 220527 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 562decaf74c61c29d30bbed4eff675f4aad969d0..3228351239d1192f54ad48b295aac38d71580e6f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,160 @@ >+2017-08-10 Youenn Fablet <youenn@apple.com> >+ >+ [Cache API] Adding generic support for CacheStorage and Cache methods >+ https://bugs.webkit.org/show_bug.cgi?id=175455 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Covered by existing tests. >+ >+ Adding a CacheStorageProvider abstraction that creates a CacheStorageConnection. >+ The CacheStorageProvider is accessed from the page for Document calls. >+ The CacheStorageConnection is responsible to implement the read/write operations on the cache database. >+ At the moment, it does nothing. >+ >+ Implementing CacheStorage APIs and Cache APIs based on the CacheStorageConnection except for Cache add and addAll which will be implemented later on. >+ >+ Adding support for CacheStorage.match function as a JS built-in as this involves promises and allows a clearer implementation. >+ Adding various accessors and constructors for Fetch constructs as needed by the Cache API implementation. >+ >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * Modules/cache/Cache.cpp: >+ (WebCore::Cache::Cache): >+ (WebCore::Cache::~Cache): >+ (WebCore::Cache::origin const): >+ Computing the cache origin that is passed to the CacheStorageConnection. >+ The CacheStorageConnection is a generic connection and not tied to any document/context. >+ (WebCore::Cache::match): Implementation of https://www.w3.org/TR/service-workers-1/#cache-match. >+ Redirect to matchAll as per spec. >+ (WebCore::Cache::matchAll): Implementation of https://www.w3.org/TR/service-workers-1/#cache-matchAll. >+ Checks for request as per spec. Then either refresh the request to response map and return all responses. >+ Or call the query cache algorithm and return copies of the responses (using clone). >+ (WebCore::Cache::put): >+ Check the request and response as per spec. >+ Add temporary rejection cases (being loaded responses, responses with ReadableStream) as there is no support for them right now. >+ Call the batch put operation. >+ (WebCore::Cache::remove): >+ Check the request and response as per spec. >+ Call the batch delete operation. >+ (WebCore::Cache::keys): >+ Refresh the request to response map and return corresponding requests. >+ Making sure to reuse the same request objects as per spec. >+ As per spec, the request to response map is ordered. We implement it as a Vector. >+ (WebCore::Cache::refreshRequestToResponseMap): >+ Use the cache storage connection to get an up-to-date list of cached records. >+ (WebCore::Cache::queryCacheMatch): >+ Implements the match algorithm defined in https://www.w3.org/TR/service-workers-1/#query-cache-algorithm. >+ This is split for queryCache as cache storage engine will need to use it when implementing the delete operation. >+ (WebCore::Cache::queryCache): >+ Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with no targetStorage argument. >+ (WebCore::Cache::queryCacheWithTargetStorage): >+ Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with a provided targetStorage argument. >+ (WebCore::Cache::batchDeleteOperation): >+ Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm but dedicated to a delete operation. >+ Delete operation are always done one at a time. >+ (WebCore::Cache::batchPutOperation): >+ Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm dedicated to a put operation. >+ Put operation can take several records in the case of addAll. This currently takes only one record as input as needed for put implementation. >+ (WebCore::Cache::updateRequestToResponseMap): >+ Update the cache request to response map based on the records retrieved from the cache storage connection. >+ * Modules/cache/Cache.h: >+ (WebCore::Cache::create): >+ (WebCore::Cache::name const): >+ * Modules/cache/Cache.idl: >+ * Modules/cache/CacheStorage.cpp: >+ (WebCore::CacheStorage::origin const): >+ Computing the cache origin that is passed to the CacheStorageConnection. >+ The CacheStorageConnection is a generic connection and not tied to any document/context. >+ (WebCore::CacheStorage::has): >+ Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-has. >+ Call the cache storage connection to refresh its cache map. >+ Then use it to check whether a cache exists. >+ (WebCore::CacheStorage::refreshCacheMap): >+ Use the cache storage connection to get the list of existing caches. >+ (WebCore::CacheStorage::open): >+ Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-open. >+ Refreshing the cache map so as to return a pre-existing cache if any. >+ (WebCore::CacheStorage::remove): >+ Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-delete-method. >+ Refreshing the cache map so as to do nothing if there is no cache to remove. >+ (WebCore::CacheStorage::keys): >+ Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-keys-method. >+ Refreshing the cache map and returnin its keys. >+ As per spec, the cache map is ordered. We implement it as a Vector. >+ (WebCore::CacheStorage::cacheMap): >+ Get the list of cache objects, used as a private accessor for JS built-ins. >+ * Modules/cache/CacheStorage.h: >+ (WebCore::CacheStorage::create): >+ (WebCore::CacheStorage::CacheStorage): >+ * Modules/cache/CacheStorage.idl: >+ * Modules/cache/CacheStorage.js: Added. >+ (match): Implementation of https://www.w3.org/TR/service-workers-1/#cache-match. >+ As per spec, using Cache.@match on either a specific cache or all caches. >+ Implementing in JS built-in is a convenient way to have a simple implementation >+ that easily relates to the specification. >+ * Modules/cache/CacheStorageConnection.cpp: Added. >+ (WebCore::CacheStorageConnection::exceptionFromError): >+ * Modules/cache/CacheStorageConnection.h: Added. >+ Makes the link between Web facing Cache API and the cache storage engine. >+ Envisioned implementation are: >+ - One main thread connection used by all documents in the given process. >+ - One connection per worker that forwards the calls to the main thread and use the main thread connection afterwards. >+ (WebCore::CacheStorageConnection::create): >+ (WebCore::CacheStorageConnection::open): >+ (WebCore::CacheStorageConnection::remove): >+ (WebCore::CacheStorageConnection::refreshCacheMap): >+ (WebCore::CacheStorageConnection::refreshRequestToResponseMap): >+ (WebCore::CacheStorageConnection::batchDeleteOperation): >+ (WebCore::CacheStorageConnection::batchPutOperation): >+ * Modules/cache/CacheStorageRecord.h: Added. A fetch record from the Web facing cache API perspective. >+ * Modules/cache/DOMWindowCaches.cpp: >+ (WebCore::DOMWindowCaches::caches const): >+ * Modules/cache/WorkerGlobalScopeCaches.cpp: >+ (WebCore::WorkerGlobalScopeCaches::from): >+ (WebCore::WorkerGlobalScopeCaches::caches const): >+ * Modules/cache/WorkerGlobalScopeCaches.h: >+ (WebCore::WorkerGlobalScopeCaches::WorkerGlobalScopeCaches): >+ * Modules/fetch/FetchBodyOwner.h: >+ (WebCore::FetchBodyOwner::isReadableStreamBody const): Added getter as it is used by cache API. >+ * Modules/fetch/FetchHeaders.h: >+ (WebCore::FetchHeaders::create): Add another create as used by the cache API. >+ (WebCore::FetchHeaders::guard const): Added getter and IPC serializer as this is something that will be stored by the cache engine. >+ * Modules/fetch/FetchLoader.cpp: >+ (WebCore::FetchLoader::start): >+ * Modules/fetch/FetchRequest.cpp: >+ (WebCore::buildOptions): In case FetchRequest::create is called from C++, there is no need to set init.window to a null value. >+ Add a check so that no value at all is the same as a unll/undefined value. >+ (WebCore::FetchRequest::resourceRequest const): >+ * Modules/fetch/FetchRequest.h: >+ * Modules/fetch/FetchResponse.cpp: >+ (WebCore::FetchResponse::bodyForInternalResponse): Cache API can consume the response body. Add this accessor for that purpose. >+ * Modules/fetch/FetchResponse.h: >+ * WebCore.xcodeproj/project.pbxproj: >+ * bindings/js/WebCoreBuiltinNames.h: >+ * inspector/InspectorOverlay.cpp: >+ (WebCore::InspectorOverlay::overlayPage): >+ * page/CacheStorageProvider.h: Added. >+ Interface to create main thread cache storage connection for the given page. >+ There will be one provider for each process. >+ Passing a sessionID so that we will create a connection per session. >+ * page/Page.cpp: >+ (WebCore::Page::Page): >+ * page/Page.h: >+ (WebCore::Page::cacheStorageProvider): >+ * page/PageConfiguration.cpp: >+ (WebCore::PageConfiguration::PageConfiguration): >+ * page/PageConfiguration.h: >+ * svg/graphics/SVGImage.cpp: >+ (WebCore::SVGImage::dataChanged): >+ >+2017-08-10 Antti Koivisto <antti@apple.com> >+ >+ Try to fix windows build. >+ >+ * style/StyleUpdate.h: >+ (WebCore::Style::TextUpdate::TextUpdate): >+ > 2017-08-10 Carlos Garcia Campos <cgarcia@igalia.com> > > [GTK] Crashes in WebCore::PasteboardHelper::fillSelectionData when source file of drag is unavailable >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 62199b90717ac486133857233a6f27b809d3de3d..22a78f494d5c19733fd285f38dc60315b330a496 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,19 @@ >+2017-08-10 Youenn Fablet <youenn@apple.com> >+ >+ [Cache API] Adding generic support for CacheStorage and Cache methods >+ https://bugs.webkit.org/show_bug.cgi?id=175455 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/Cache/WebCacheStorageProvider.h: Added. >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::m_cpuLimit): >+ * WebProcess/WebProcess.cpp: >+ (WebKit::WebProcess::WebProcess): >+ * WebProcess/WebProcess.h: >+ (WebKit::WebProcess::cacheStorageProvider): >+ > 2017-08-10 Zan Dobersek <zdobersek@igalia.com> > > [GTK] Don't use --whole-archive linking flags for the WebKit2 target libraries >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index a66294a2e3b363a33307fac6684766d04f29896a..cebe6f2ff6a7fc281ca3b01540e7855bc87c3ee1 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,13 @@ >+2017-08-10 Youenn Fablet <youenn@apple.com> >+ >+ [Cache API] Adding generic support for CacheStorage and Cache methods >+ https://bugs.webkit.org/show_bug.cgi?id=175455 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView/WebView.mm: >+ (-[WebView _commonInitializationWithFrameName:groupName:]): >+ > 2017-08-09 Chris Dumez <cdumez@apple.com> > > Disable Beacon API on WK1 DRT and WK2 when not using NETWORK_SESSION >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index e1ad58e3ecfe9ae35122c2cdfb1cdcc6ee7bc2b3..89e65bc2c5d7646a681bcdd82c99ff354d189de0 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -893,6 +893,7 @@ set(WebCore_SOURCES > > Modules/cache/Cache.cpp > Modules/cache/CacheStorage.cpp >+ Modules/cache/CacheStorageConnection.cpp > Modules/cache/DOMWindowCaches.cpp > Modules/cache/WorkerGlobalScopeCaches.cpp > >@@ -3852,6 +3853,7 @@ add_dependencies(WebCoreTestSupportBindings WebCoreDerivedSources) > # WebCore JS Builtins > > set(WebCore_BUILTINS_SOURCES >+ ${WEBCORE_DIR}/Modules/cache/CacheStorage.js > ${WEBCORE_DIR}/Modules/fetch/FetchInternals.js > ${WEBCORE_DIR}/Modules/fetch/FetchResponse.js > ${WEBCORE_DIR}/Modules/mediastream/NavigatorUserMedia.js >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index 8d564e6770bfd8442d578d54c2b981fb85e1b7f8..7e0538c410d3f34b55c104e177070aac0483c3a0 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -1397,6 +1397,7 @@ CommandLineAPIModuleSource.h : CommandLineAPIModuleSource.js > # WebCore JS Builtins > > WebCore_BUILTINS_SOURCES = \ >+ $(WebCore)/Modules/cache/CacheStorage.js \ > $(WebCore)/Modules/fetch/FetchInternals.js \ > $(WebCore)/Modules/fetch/FetchResponse.js \ > $(WebCore)/Modules/mediastream/NavigatorUserMedia.js \ >diff --git a/Source/WebCore/Modules/cache/Cache.cpp b/Source/WebCore/Modules/cache/Cache.cpp >index e19af55029564d9574542b3eb3348432383f67d5..b930d25fd79fc5dfa6c30e50af2f20851995b1f1 100644 >--- a/Source/WebCore/Modules/cache/Cache.cpp >+++ b/Source/WebCore/Modules/cache/Cache.cpp >@@ -26,16 +26,87 @@ > #include "config.h" > #include "Cache.h" > >+#include "CacheQueryOptions.h" >+#include "FetchResponse.h" >+#include "JSFetchRequest.h" >+#include "JSFetchResponse.h" >+#include "ScriptExecutionContext.h" >+#include "URL.h" >+ > namespace WebCore { > >-void Cache::match(RequestInfo&&, std::optional<CacheQueryOptions>&&, Ref<DeferredPromise>&& promise) >+Cache::Cache(ScriptExecutionContext& context, String&& name, Ref<CacheStorageConnection>&& connection) >+ : ActiveDOMObject(&context) >+ , m_name(WTFMove(name)) >+ , m_connection(WTFMove(connection)) > { >- promise->reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ suspendIfNeeded(); > } > >-void Cache::matchAll(std::optional<RequestInfo>&&, std::optional<CacheQueryOptions>&&, MatchAllPromise&& promise) >+Cache::~Cache() > { >- promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+} >+ >+String Cache::origin() const >+{ >+ // FIXME: Do we really need to check for origin being null? >+ auto* origin = scriptExecutionContext() ? scriptExecutionContext()->securityOrigin() : nullptr; >+ return origin ? origin->toString() : String(); >+} >+ >+void Cache::match(RequestInfo&& info, CacheQueryOptions&& options, Ref<DeferredPromise>&& promise) >+{ >+ matchAll(WTFMove(info), WTFMove(options), WTFMove(promise), MatchType::OnlyFirst); >+} >+ >+void Cache::matchAll(std::optional<RequestInfo>&& info, CacheQueryOptions&& options, Ref<DeferredPromise>&& promise, MatchType matchType) >+{ >+ RefPtr<FetchRequest> request; >+ if (info) { >+ if (WTF::holds_alternative<RefPtr<FetchRequest>>(info.value())) { >+ request = WTF::get<RefPtr<FetchRequest>>(info.value()).releaseNonNull(); >+ if (request->method() != "GET" && !options.ignoreMethod) { >+ if (matchType == MatchType::OnlyFirst) { >+ promise->resolve(); >+ return; >+ } >+ promise->resolve<IDLSequence<IDLInterface<FetchResponse>>>(Vector<Ref<FetchResponse>> { }); >+ return; >+ } >+ } else { >+ if (UNLIKELY(!scriptExecutionContext())) >+ return; >+ request = FetchRequest::create(*scriptExecutionContext(), WTFMove(info.value()), { }).releaseReturnValue(); >+ } >+ } >+ >+ if (!request) { >+ ASSERT(matchType == MatchType::All); >+ refreshRequestToResponseMap([this, promise = WTFMove(promise)]() { >+ Vector<Ref<FetchResponse>> responses; >+ responses.reserveInitialCapacity(m_requestToResponseMap.size()); >+ for (auto& record : m_requestToResponseMap) >+ responses.uncheckedAppend(record.response->cloneForJS()); >+ promise->resolve<IDLSequence<IDLInterface<FetchResponse>>>(responses); >+ }); >+ return; >+ } >+ queryCache(request.releaseNonNull(), WTFMove(options), [matchType, promise = WTFMove(promise)](const Vector<CacheStorageRecord>& records) mutable { >+ if (matchType == MatchType::OnlyFirst) { >+ if (records.size()) { >+ promise->resolve<IDLInterface<FetchResponse>>(records[0].response.get()); >+ return; >+ } >+ promise->resolve(); >+ return; >+ } >+ >+ Vector<Ref<FetchResponse>> responses; >+ responses.reserveInitialCapacity(records.size()); >+ for (auto& record : records) >+ responses.uncheckedAppend(record.response->cloneForJS()); >+ promise->resolve<IDLSequence<IDLInterface<FetchResponse>>>(responses); >+ }); > } > > void Cache::add(RequestInfo&&, DOMPromiseDeferred<void>&& promise) >@@ -48,19 +119,276 @@ void Cache::addAll(Vector<RequestInfo>&&, DOMPromiseDeferred<void>&& promise) > promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); > } > >-void Cache::put(RequestInfo&&, Ref<FetchResponse>&&, DOMPromiseDeferred<void>&& promise) >+void Cache::put(RequestInfo&& info, Ref<FetchResponse>&& response, DOMPromiseDeferred<void>&& promise) > { >- promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ RefPtr<FetchRequest> request; >+ if (WTF::holds_alternative<RefPtr<FetchRequest>>(info)) { >+ request = WTF::get<RefPtr<FetchRequest>>(info).releaseNonNull(); >+ if (request->method() != "GET") { >+ promise.reject(Exception { TypeError, ASCIILiteral("Request method is not GET") }); >+ return; >+ } >+ } else { >+ if (UNLIKELY(!scriptExecutionContext())) >+ return; >+ request = FetchRequest::create(*scriptExecutionContext(), WTFMove(info), { }).releaseReturnValue(); >+ } >+ >+ if (!protocolIsInHTTPFamily(request->url())) { >+ promise.reject(Exception { TypeError, ASCIILiteral("Request url is not HTTP/HTTPS") }); >+ return; >+ } >+ >+ auto varyValue = response->headers().internalHeaders().get(WebCore::HTTPHeaderName::Vary); >+ Vector<String> varyingHeaderNames; >+ bool hasVaryHeaderStar = false; >+ varyValue.split(',', false, [&](const StringView& view) { >+ if (!hasVaryHeaderStar && view == "*") >+ hasVaryHeaderStar = true; >+ }); >+ >+ if (hasVaryHeaderStar) { >+ promise.reject(Exception { TypeError, ASCIILiteral("Response has a '*' Vary header value") }); >+ return; >+ } >+ >+ if (response->isDisturbed()) { >+ promise.reject(Exception { TypeError, ASCIILiteral("Response is disturbed or locked") }); >+ return; >+ } >+ >+ // FIXME: Add support for being loaded responses. >+ if (response->isLoading()) { >+ promise.reject(Exception { NotSupportedError, ASCIILiteral("Caching a loading Response is not yet supported") }); >+ return; >+ } >+ // FIXME: Add support for ReadableStream. >+ if (response->isReadableStreamBody()) { >+ promise.reject(Exception { NotSupportedError, ASCIILiteral("Caching a Response with data stored in a ReadableStream is not yet supported") }); >+ return; >+ } >+ >+ batchPutOperation(*request, response.get(), [promise = WTFMove(promise)](CacheStorageConnection::Error error) mutable { >+ if (error != CacheStorageConnection::Error::None) { >+ promise.reject(CacheStorageConnection::exceptionFromError(error)); >+ return; >+ } >+ promise.resolve(); >+ }); > } > >-void Cache::remove(RequestInfo&&, std::optional<CacheQueryOptions>&&, DOMPromiseDeferred<IDLBoolean>&& promise) >+void Cache::remove(RequestInfo&& info, CacheQueryOptions&& options, DOMPromiseDeferred<IDLBoolean>&& promise) > { >- promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ RefPtr<FetchRequest> request; >+ if (WTF::holds_alternative<RefPtr<FetchRequest>>(info)) { >+ request = WTF::get<RefPtr<FetchRequest>>(info).releaseNonNull(); >+ if (request->method() != "GET" && !options.ignoreMethod) { >+ promise.resolve(false); >+ return; >+ } >+ } else { >+ if (UNLIKELY(!scriptExecutionContext())) >+ return; >+ request = FetchRequest::create(*scriptExecutionContext(), WTFMove(info), { }).releaseReturnValue(); >+ } >+ >+ batchDeleteOperation(*request, WTFMove(options), [promise = WTFMove(promise)](bool didDelete, CacheStorageConnection::Error error) mutable { >+ if (error != CacheStorageConnection::Error::None) { >+ promise.reject(CacheStorageConnection::exceptionFromError(error)); >+ return; >+ } >+ promise.resolve(didDelete); >+ }); > } > >-void Cache::keys(std::optional<RequestInfo>&&, std::optional<CacheQueryOptions>&&, KeysPromise&& promise) >+void Cache::keys(std::optional<RequestInfo>&& info, CacheQueryOptions&& options, KeysPromise&& promise) > { >- promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ RefPtr<FetchRequest> request; >+ if (info) { >+ if (WTF::holds_alternative<RefPtr<FetchRequest>>(info.value())) { >+ request = WTF::get<RefPtr<FetchRequest>>(info.value()).releaseNonNull(); >+ if (request->method() != "GET" && !options.ignoreMethod) { >+ promise.resolve(Vector<Ref<FetchRequest>> { }); >+ return; >+ } >+ } else { >+ if (UNLIKELY(!scriptExecutionContext())) >+ return; >+ request = FetchRequest::create(*scriptExecutionContext(), WTFMove(info.value()), { }).releaseReturnValue(); >+ } >+ } >+ >+ if (!request) { >+ refreshRequestToResponseMap([this, promise = WTFMove(promise)]() mutable { >+ Vector<Ref<FetchRequest>> requests; >+ requests.reserveInitialCapacity(m_requestToResponseMap.size()); >+ for (auto& record : m_requestToResponseMap) >+ requests.uncheckedAppend(record.request.copyRef()); >+ promise.resolve(requests); >+ }); >+ return; >+ } >+ >+ queryCache(request.releaseNonNull(), WTFMove(options), [promise = WTFMove(promise)](const Vector<CacheStorageRecord>& records) mutable { >+ Vector<Ref<FetchRequest>> requests; >+ requests.reserveInitialCapacity(records.size()); >+ for (auto& record : records) >+ requests.uncheckedAppend(record.request.copyRef()); >+ promise.resolve(requests); >+ }); >+} >+ >+void Cache::refreshRequestToResponseMap(Function<void()>&& callback) >+{ >+ String origin = this->origin(); >+ if (origin.isNull()) >+ return; >+ >+ setPendingActivity(this); >+ m_connection->refreshRecords(origin, m_name, [this, callback = WTFMove(callback)](Vector<CacheStorageConnection::Record>&& records) { >+ if (!m_isStopped) { >+ updateRequestToResponseMap(WTFMove(records)); >+ callback(); >+ } >+ unsetPendingActivity(this); >+ }); >+} >+ >+bool Cache::queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse& cachedResponse, const CacheQueryOptions& options) >+{ >+ ASSERT(options.ignoreMethod || request.httpMethod() == "GET"); >+ >+ URL requestURL = request.url(); >+ URL cachedRequestURL = cachedRequest.url(); >+ >+ if (options.ignoreSearch) { >+ requestURL.setQuery({ }); >+ cachedRequestURL.setQuery({ }); >+ } >+ if (!equalIgnoringFragmentIdentifier(requestURL, cachedRequestURL)) >+ return false; >+ >+ if (options.ignoreVary) >+ return true; >+ >+ auto varyValue = cachedResponse.httpHeaderField(WebCore::HTTPHeaderName::Vary); >+ if (varyValue.isNull()) >+ return true; >+ >+ Vector<String> varyingHeaderNames; >+ varyValue.split(',', varyingHeaderNames); >+ if (varyingHeaderNames.contains("*")) >+ return false; >+ >+ for (auto& name : varyingHeaderNames) { >+ if (cachedRequest.httpHeaderField(name) != request.httpHeaderField(name)) >+ return false; >+ } >+ return true; >+} >+ >+void Cache::queryCache(Ref<FetchRequest>&& request, CacheQueryOptions&& options, Function<void(const Vector<CacheStorageRecord>&)>&& callback) >+{ >+ refreshRequestToResponseMap([this, request = WTFMove(request), options = WTFMove(options), callback = WTFMove(callback)]() mutable { >+ callback(queryCacheWithTargetStorage(request.get(), options, m_requestToResponseMap)); >+ }); >+} >+ >+Vector<CacheStorageRecord> Cache::queryCacheWithTargetStorage(const FetchRequest& request, const CacheQueryOptions& options, const Vector<CacheStorageRecord>& targetStorage) >+{ >+ if (!options.ignoreMethod && request.method() != "GET") >+ return { }; >+ >+ Vector<CacheStorageRecord> records; >+ for (auto& record : targetStorage) { >+ if (queryCacheMatch(request.internalRequest().request, record.request->internalRequest().request, record.response->response(), options)) >+ records.append({ record.identifier, record.request.copyRef(), record.response.copyRef() }); >+ } >+ return records; >+} >+ >+void Cache::batchDeleteOperation(const FetchRequest& request, CacheQueryOptions&& options, Function<void(bool didRemoval, CacheStorageConnection::Error error)>&& callback) >+{ >+ String origin = this->origin(); >+ if (origin.isNull()) >+ return; >+ >+ setPendingActivity(this); >+ m_connection->batchDeleteOperation(origin, m_name, request.internalRequest().request, WTFMove(options), [this, callback = WTFMove(callback)](Vector<uint64_t>&& records, CacheStorageConnection::Error error) { >+ if (!m_isStopped) { >+ if (error == CacheStorageConnection::Error::None) >+ m_requestToResponseMap.removeAllMatching([&](const auto& item) { return records.contains(item.identifier); }); >+ >+ callback(!!records.size(), error); >+ } >+ unsetPendingActivity(this); >+ }); >+} >+ >+void Cache::batchPutOperation(const FetchRequest& request, const FetchResponse& response, Function<void(CacheStorageConnection::Error)>&& callback) >+{ >+ // FIXME: Add a setHTTPHeaderFields on ResourceResponseBase. >+ ResourceResponse cachedResponse = response.response(); >+ for (auto& header : response.headers().internalHeaders()) >+ cachedResponse.setHTTPHeaderField(header.key, header.value); >+ >+ ResourceRequest cachedRequest = request.internalRequest().request; >+ cachedRequest.setHTTPHeaderFields(request.headers().internalHeaders()); >+ >+ CacheStorageConnection::Record record = { 0, >+ request.headers().guard(), WTFMove(cachedRequest), request.internalRequest().options, request.internalRequest().referrer, >+ response.headers().guard(), WTFMove(cachedResponse) >+ }; >+ >+ String origin = this->origin(); >+ if (origin.isNull()) >+ return; >+ >+ setPendingActivity(this); >+ m_connection->batchPutOperation(origin, m_name, WTFMove(record), [this, callback = WTFMove(callback)](Vector<uint64_t>&&, CacheStorageConnection::Error error) { >+ if (!m_isStopped) >+ callback(error); >+ >+ unsetPendingActivity(this); >+ }); >+} >+ >+void Cache::updateRequestToResponseMap(Vector<CacheStorageConnection::Record>&& records) >+{ >+ ASSERT(scriptExecutionContext()); >+ Vector<CacheStorageRecord> newMap; >+ >+ for (auto& record : records) { >+ size_t index = m_requestToResponseMap.findMatching([&](const auto& item) { return item.identifier == record.identifier; }); >+ if (index != notFound) >+ newMap.append(WTFMove(m_requestToResponseMap[index])); >+ else { >+ auto requestHeaders = FetchHeaders::create(record.requestHeadersGuard, HTTPHeaderMap { record.request.httpHeaderFields() }); >+ FetchRequest::InternalRequest internalRequest = { WTFMove(record.request), WTFMove(record.options), WTFMove(record.referrer) }; >+ auto request = FetchRequest::create(*scriptExecutionContext(), std::nullopt, WTFMove(requestHeaders), WTFMove(internalRequest)); >+ >+ auto responseHeaders = FetchHeaders::create(record.responseHeadersGuard, HTTPHeaderMap { record.response.httpHeaderFields() }); >+ auto response = FetchResponse::create(*scriptExecutionContext(), std::nullopt, WTFMove(responseHeaders), WTFMove(record.response)); >+ >+ newMap.append(CacheStorageRecord { record.identifier, WTFMove(request), WTFMove(response) }); >+ } >+ } >+ m_requestToResponseMap = WTFMove(newMap); >+} >+ >+void Cache::stop() >+{ >+ m_isStopped = true; >+} >+ >+const char* Cache::activeDOMObjectName() const >+{ >+ return "Cache"; >+} >+ >+bool Cache::canSuspendForDocumentSuspension() const >+{ >+ return !m_requestToResponseMap.size() && !hasPendingActivity(); > } > > >diff --git a/Source/WebCore/Modules/cache/Cache.h b/Source/WebCore/Modules/cache/Cache.h >index 0082acd556ddf5dee9f750665c2f4e9eb9dd965e..c6aefc179afd095e2042688b5578585c40d4b635 100644 >--- a/Source/WebCore/Modules/cache/Cache.h >+++ b/Source/WebCore/Modules/cache/Cache.h >@@ -25,36 +25,61 @@ > > #pragma once > >-#include "FetchRequest.h" >+#include "ActiveDOMObject.h" >+#include "CacheStorageConnection.h" >+#include "CacheStorageRecord.h" > > namespace WebCore { > >-class FetchResponse; >+class CacheQueryOptions; >+class ScriptExecutionContext; > >-struct CacheQueryOptions; >- >-class Cache : public RefCounted<Cache> { >+class Cache final : public RefCounted<Cache>, public ActiveDOMObject { > public: >- static Ref<Cache> create(String&& name) { return adoptRef(*new Cache(WTFMove(name))); } >+ static Ref<Cache> create(ScriptExecutionContext& context, String&& name, Ref<CacheStorageConnection>&& connection) { return adoptRef(*new Cache(context, WTFMove(name), WTFMove(connection))); } >+ ~Cache(); > > using RequestInfo = FetchRequest::Info; > >- using MatchAllPromise = DOMPromiseDeferred<IDLSequence<IDLInterface<FetchResponse>>>; > using KeysPromise = DOMPromiseDeferred<IDLSequence<IDLInterface<FetchRequest>>>; > >- void match(RequestInfo&&, std::optional<CacheQueryOptions>&&, Ref<DeferredPromise>&&); >- void matchAll(std::optional<RequestInfo>&&, std::optional<CacheQueryOptions>&&, MatchAllPromise&&); >+ enum class MatchType { All, OnlyFirst }; >+ void match(RequestInfo&&, CacheQueryOptions&&, Ref<DeferredPromise>&&); >+ void matchAll(std::optional<RequestInfo>&&, CacheQueryOptions&&, Ref<DeferredPromise>&&, MatchType = MatchType::All); > void add(RequestInfo&&, DOMPromiseDeferred<void>&&); > > void addAll(Vector<RequestInfo>&&, DOMPromiseDeferred<void>&&); > void put(RequestInfo&&, Ref<FetchResponse>&&, DOMPromiseDeferred<void>&&); >- void remove(RequestInfo&&, std::optional<CacheQueryOptions>&&, DOMPromiseDeferred<IDLBoolean>&&); >- void keys(std::optional<RequestInfo>&&, std::optional<CacheQueryOptions>&&, KeysPromise&&); >+ void remove(RequestInfo&&, CacheQueryOptions&&, DOMPromiseDeferred<IDLBoolean>&&); >+ void keys(std::optional<RequestInfo>&&, CacheQueryOptions&&, KeysPromise&&); >+ >+ const String& name() const { return m_name; } >+ >+ WEBCORE_EXPORT static bool queryCacheMatch(const ResourceRequest& request, const ResourceRequest& cachedRequest, const ResourceResponse&, const CacheQueryOptions&); > > private: >- explicit Cache(String&& name) : m_name(WTFMove(name)) { } >+ Cache(ScriptExecutionContext&, String&& name, Ref<CacheStorageConnection>&&); >+ >+ // ActiveDOMObject >+ void stop() final; >+ const char* activeDOMObjectName() const final; >+ bool canSuspendForDocumentSuspension() const final; >+ >+ String origin() const; >+ >+ void refreshRequestToResponseMap(Function<void()>&&); >+ Vector<CacheStorageRecord> queryCacheWithTargetStorage(const FetchRequest&, const CacheQueryOptions&, const Vector<CacheStorageRecord>&); >+ void queryCache(Ref<FetchRequest>&&, CacheQueryOptions&&, Function<void(const Vector<CacheStorageRecord>&)>&&); >+ void batchDeleteOperation(const FetchRequest&, CacheQueryOptions&&, Function<void(bool didRemoval, CacheStorageConnection::Error)>&&); >+ void batchPutOperation(const FetchRequest&, const FetchResponse&, Function<void(CacheStorageConnection::Error)>&&); >+ >+ void updateRequestToResponseMap(Vector<CacheStorageConnection::Record>&&); > > String m_name; >+ Ref<CacheStorageConnection> m_connection; >+ >+ Vector<CacheStorageRecord> m_requestToResponseMap; >+ bool m_isStopped { false }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/cache/Cache.idl b/Source/WebCore/Modules/cache/Cache.idl >index d47969155d20a4f7bfa38a6dc0b2df32256a94e0..3e6c7ad67c7f96b848932b814c53e82862e768f1 100644 >--- a/Source/WebCore/Modules/cache/Cache.idl >+++ b/Source/WebCore/Modules/cache/Cache.idl >@@ -29,13 +29,16 @@ typedef (FetchRequest or USVString) RequestInfo; > SecureContext, > Exposed=(Window,Worker), > EnabledAtRuntime=CacheAPI, >- ImplementationLacksVTable, >+ PrivateIdentifier, >+ PublicIdentifier, > ] interface Cache { > [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); >- [NewObject] Promise<sequence<FetchResponse>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); >+ [NewObject, PrivateIdentifier, PublicIdentifier] Promise<sequence<FetchResponse>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); > [NewObject] Promise<void> add(RequestInfo request); > [NewObject] Promise<void> addAll(sequence<RequestInfo> requests); > [NewObject] Promise<void> put(RequestInfo request, FetchResponse response); > [NewObject, ImplementedAs=remove] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options); > [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options); >+ >+ [PrivateIdentifier, ImplementedAs=name] DOMString cacheName(); > }; >diff --git a/Source/WebCore/Modules/cache/CacheQueryOptions.h b/Source/WebCore/Modules/cache/CacheQueryOptions.h >index 68f67facf356871eef4e5546958b727a6593693b..4f8b4deeca1a7df68145704000a6a61ac0cb190c 100644 >--- a/Source/WebCore/Modules/cache/CacheQueryOptions.h >+++ b/Source/WebCore/Modules/cache/CacheQueryOptions.h >@@ -29,7 +29,8 @@ > > namespace WebCore { > >-struct CacheQueryOptions { >+class CacheQueryOptions { >+public: > bool ignoreSearch { false }; > bool ignoreMethod { false }; > bool ignoreVary { false }; >diff --git a/Source/WebCore/Modules/cache/CacheStorage.cpp b/Source/WebCore/Modules/cache/CacheStorage.cpp >index 12367be966e1e3a28a9e29dbfe4b83bd5acdecc6..cbde67b4ca98688262f5dc0c0d1e3c6a3060198c 100644 >--- a/Source/WebCore/Modules/cache/CacheStorage.cpp >+++ b/Source/WebCore/Modules/cache/CacheStorage.cpp >@@ -26,31 +26,141 @@ > #include "config.h" > #include "CacheStorage.h" > >+#include "CacheQueryOptions.h" >+#include "JSCache.h" >+#include "ScriptExecutionContext.h" >+ > namespace WebCore { > >-void CacheStorage::match(RequestInfo&&, std::optional<CacheQueryOptions>&&, Ref<DeferredPromise>&& promise) >+CacheStorage::CacheStorage(ScriptExecutionContext& context, Ref<CacheStorageConnection>&& connection) >+ : ActiveDOMObject(&context) >+ , m_connection(WTFMove(connection)) >+{ >+ suspendIfNeeded(); >+} >+ >+String CacheStorage::origin() const > { >- promise->reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ // FIXME: Do we really need to check for origin being null? >+ auto* origin = scriptExecutionContext() ? scriptExecutionContext()->securityOrigin() : nullptr; >+ return origin ? origin->toString() : String(); > } > >-void CacheStorage::has(const String&, DOMPromiseDeferred<IDLBoolean>&& promise) >+void CacheStorage::has(const String& name, DOMPromiseDeferred<IDLBoolean>&& promise) > { >- promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ refreshCacheMap([this, name, promise = WTFMove(promise)]() mutable { >+ promise.resolve(m_cacheMap.findMatching([&](auto& item) { return item->name() == name; }) != notFound); >+ }); > } > >-void CacheStorage::open(const String&, DOMPromiseDeferred<IDLInterface<Cache>>&& promise) >+void CacheStorage::refreshCacheMap(Function<void()>&& callback) > { >- promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ String origin = this->origin(); >+ if (origin.isNull()) >+ return; >+ >+ setPendingActivity(this); >+ m_connection->refreshCacheMap(origin, [this, callback = WTFMove(callback)](const Vector<String>& cacheNames) { >+ if (!m_isStopped) { >+ m_cacheMap.removeAllMatching([&](auto& cache) { return !cacheNames.contains(cache->name()); }); >+ >+ std::sort(m_cacheMap.begin(), m_cacheMap.end(), [&](auto& a, auto& b) { >+ return cacheNames.find(a->name()) < cacheNames.find(b->name()); >+ }); >+ >+ callback(); >+ } >+ unsetPendingActivity(this); >+ }); > } > >-void CacheStorage::remove(const String&, DOMPromiseDeferred<IDLBoolean>&& promise) >+void CacheStorage::open(const String& name, DOMPromiseDeferred<IDLInterface<Cache>>&& promise) > { >- promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ refreshCacheMap([this, name, promise = WTFMove(promise)]() mutable { >+ auto position = m_cacheMap.findMatching([&](auto& item) { return item->name() == name; }); >+ if (position != notFound) { >+ promise.resolve(m_cacheMap[position]); >+ return; >+ } >+ >+ String origin = this->origin(); >+ if (origin.isNull()) >+ return; >+ >+ setPendingActivity(this); >+ m_connection->open(origin, name, [this, name, promise = WTFMove(promise)](CacheStorageConnection::Error error) mutable { >+ if (!m_isStopped) { >+ if (error != CacheStorageConnection::Error::None) >+ promise.reject(CacheStorageConnection::exceptionFromError(error)); >+ else { >+ auto cache = Cache::create(*scriptExecutionContext(), String(name), m_connection.copyRef()); >+ promise.resolve(cache); >+ m_cacheMap.append(WTFMove(cache)); >+ } >+ } >+ unsetPendingActivity(this); >+ }); >+ }); >+} >+ >+void CacheStorage::remove(const String& name, DOMPromiseDeferred<IDLBoolean>&& promise) >+{ >+ refreshCacheMap([this, name, promise = WTFMove(promise)]() mutable { >+ auto position = m_cacheMap.findMatching([&](auto& item) { return item->name() == name; }); >+ if (position == notFound) { >+ promise.resolve(false); >+ return; >+ } >+ >+ String origin = this->origin(); >+ if (origin.isNull()) >+ return; >+ >+ setPendingActivity(this); >+ m_connection->remove(origin, name, [this, name, promise = WTFMove(promise)](CacheStorageConnection::Error error) mutable { >+ if (!m_isStopped) { >+ if (error != CacheStorageConnection::Error::None) >+ promise.reject(CacheStorageConnection::exceptionFromError(error)); >+ else >+ promise.resolve(true); >+ } >+ unsetPendingActivity(this); >+ }); >+ m_cacheMap.remove(position); >+ }); > } > > void CacheStorage::keys(KeysPromise&& promise) > { >- promise.reject(Exception { TypeError, ASCIILiteral("Not implemented")}); >+ refreshCacheMap([this, promise = WTFMove(promise)]() mutable { >+ Vector<String> keys; >+ keys.reserveInitialCapacity(m_cacheMap.size()); >+ for (auto& cache : m_cacheMap) >+ keys.uncheckedAppend(cache->name()); >+ promise.resolve(keys); >+ }); >+} >+ >+void CacheStorage::cacheMap(CacheMapPromise&& promise) >+{ >+ refreshCacheMap([this, promise = WTFMove(promise)]() mutable { >+ promise.resolve(m_cacheMap); >+ }); >+} >+ >+void CacheStorage::stop() >+{ >+ m_isStopped = true; >+} >+ >+const char* CacheStorage::activeDOMObjectName() const >+{ >+ return "CacheStorage"; >+} >+ >+bool CacheStorage::canSuspendForDocumentSuspension() const >+{ >+ return !m_cacheMap.size() && !hasPendingActivity(); > } > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/cache/CacheStorage.h b/Source/WebCore/Modules/cache/CacheStorage.h >index fa26900036c326736621fcb837c7771eaa8d8223..d046141b1975eda81ca1bd03eb87a21f4266a9f9 100644 >--- a/Source/WebCore/Modules/cache/CacheStorage.h >+++ b/Source/WebCore/Modules/cache/CacheStorage.h >@@ -25,29 +25,44 @@ > > #pragma once > >+#include "Cache.h" >+#include "CacheStorageConnection.h" > #include "FetchRequest.h" >+#include <wtf/Forward.h> > > namespace WebCore { > >-class Cache; >+class CacheQueryOptions; >+class ScriptExecutionContext; > >-struct CacheQueryOptions; >- >-class CacheStorage : public RefCounted<CacheStorage> { >+class CacheStorage : public RefCounted<CacheStorage>, public ActiveDOMObject { > public: >- static Ref<CacheStorage> create() { return adoptRef(*new CacheStorage()); } >+ static Ref<CacheStorage> create(ScriptExecutionContext& context, Ref<CacheStorageConnection>&& connection) { return adoptRef(*new CacheStorage(context, WTFMove(connection))); } > >- using RequestInfo = FetchRequest::Info; > using KeysPromise = DOMPromiseDeferred<IDLSequence<IDLDOMString>>; > >- void match(RequestInfo&&, std::optional<CacheQueryOptions>&&, Ref<DeferredPromise>&&); > void has(const String&, DOMPromiseDeferred<IDLBoolean>&&); > void open(const String&, DOMPromiseDeferred<IDLInterface<Cache>>&&); > void remove(const String&, DOMPromiseDeferred<IDLBoolean>&&); > void keys(KeysPromise&&); > >+ using CacheMapPromise = DOMPromiseDeferred<IDLSequence<IDLInterface<Cache>>>; >+ void cacheMap(CacheMapPromise&&); >+ > private: >- CacheStorage() = default; >+ CacheStorage(ScriptExecutionContext&, Ref<CacheStorageConnection>&&); >+ >+ // ActiveDOMObject >+ void stop() final; >+ const char* activeDOMObjectName() const final; >+ bool canSuspendForDocumentSuspension() const final; >+ >+ void refreshCacheMap(Function<void()>&&); >+ String origin() const; >+ >+ Vector<Ref<Cache>> m_cacheMap; >+ Ref<CacheStorageConnection> m_connection; >+ bool m_isStopped { false }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/cache/CacheStorage.idl b/Source/WebCore/Modules/cache/CacheStorage.idl >index 8d71e0903e76e1a4b62bfb6f028496fb986f062a..78f573682b115200919cc9a79c88c6564fc885ab 100644 >--- a/Source/WebCore/Modules/cache/CacheStorage.idl >+++ b/Source/WebCore/Modules/cache/CacheStorage.idl >@@ -29,11 +29,14 @@ typedef (FetchRequest or USVString) RequestInfo; > SecureContext, > Exposed=(Window,Worker), > EnabledAtRuntime=CacheAPI, >- ImplementationLacksVTable, >+ PrivateIdentifier, >+ PublicIdentifier, > ] interface CacheStorage { >- [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); >+ [NewObject, JSBuiltin] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); > [NewObject] Promise<boolean> has(DOMString cacheName); > [NewObject] Promise<Cache> open(DOMString cacheName); > [NewObject, ImplementedAs=remove] Promise<boolean> delete(DOMString cacheName); > [NewObject] Promise<sequence<DOMString>> keys(); >+ >+ [PrivateIdentifier] Promise<sequence<Cache>> cacheMap(); > }; >diff --git a/Source/WebCore/Modules/cache/CacheStorage.js b/Source/WebCore/Modules/cache/CacheStorage.js >new file mode 100644 >index 0000000000000000000000000000000000000000..d05c1abce7f75834976305d832cbf283addf2d78 >--- /dev/null >+++ b/Source/WebCore/Modules/cache/CacheStorage.js >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+function match(request) >+{ >+ if (!(this instanceof @CacheStorage)) >+ return @Promise.@reject(@makeThisTypeError("CacheStorage", "match")); >+ >+ return @CacheStorage.prototype.@cacheMap.@call(this).then((cacheMap) => { >+ let options = arguments[1]; >+ if (@isObject(options) && options.cacheName) { >+ for (let cache of cacheMap) { >+ if (@Cache.prototype.@cacheName.@call(cache) === options.cacheName) { >+ return @Cache.prototype.@matchAll.@call(cache, request, options).then((result) => { >+ if (result.length) >+ return result[0]; >+ }); >+ } >+ } >+ return @Promise.@resolve(); >+ } >+ >+ function matchNextCache(cacheMap, request, options, counter) { >+ if (counter === cacheMap.length) >+ return @Promise.@resolve(); >+ >+ let cache = @CacheStorage.prototype.@get(cacheMap[counter]); >+ return @Cache.prototype.@matchAll.@call(cache, request, options).then((result) => { >+ if (result.length) >+ return result[0]; >+ return matchNextCache(cacheMap, request, options, counter + 1); >+ }); >+ } >+ return matchNextCache(cacheMap, request, options, 0); >+ }); >+} >diff --git a/Source/WebCore/Modules/cache/CacheStorageConnection.cpp b/Source/WebCore/Modules/cache/CacheStorageConnection.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..29ebb81d6cda24d6c4b095213da763fa96de294b >--- /dev/null >+++ b/Source/WebCore/Modules/cache/CacheStorageConnection.cpp >@@ -0,0 +1,46 @@ >+ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "CacheStorageConnection.h" >+ >+#include "Exception.h" >+ >+namespace WebCore { >+ >+Exception CacheStorageConnection::exceptionFromError(Error error) >+{ >+ switch (error) { >+ case Error::None: >+ ASSERT_NOT_REACHED(); >+ return Exception { TypeError, ASCIILiteral("Unknown error") }; >+ case Error::NotImplemented: >+ return Exception { TypeError, ASCIILiteral("Not implemented") }; >+ }; >+} >+ >+} // namespace WebCore >+ >diff --git a/Source/WebCore/Modules/cache/CacheStorageConnection.h b/Source/WebCore/Modules/cache/CacheStorageConnection.h >new file mode 100644 >index 0000000000000000000000000000000000000000..96091ae5c04af0eb5f865d6c529aa57f75b79f26 >--- /dev/null >+++ b/Source/WebCore/Modules/cache/CacheStorageConnection.h >@@ -0,0 +1,78 @@ >+ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "FetchHeaders.h" >+#include "FetchOptions.h" >+#include "ResourceRequest.h" >+#include "ResourceResponse.h" >+#include <wtf/ThreadSafeRefCounted.h> >+ >+namespace WebCore { >+ >+class CacheQueryOptions; >+ >+class CacheStorageConnection : public ThreadSafeRefCounted<CacheStorageConnection> { >+public: >+ enum class Error { >+ None, >+ NotImplemented, >+ }; >+ >+ static Exception exceptionFromError(Error); >+ >+ struct Record { >+ uint64_t identifier; >+ >+ FetchHeaders::Guard requestHeadersGuard; >+ ResourceRequest request; >+ FetchOptions options; >+ String referrer; >+ >+ FetchHeaders::Guard responseHeadersGuard; >+ ResourceResponse response; >+ }; >+ >+ static Ref<CacheStorageConnection> create() { return adoptRef(*new CacheStorageConnection()); } >+ virtual ~CacheStorageConnection() = default; >+ >+ using ReportErrorCallback = WTF::Function<void(Error)>; >+ using CacheMapCallback = WTF::Function<void(const Vector<String>&&)>; >+ using RecordsCallback = WTF::Function<void(Vector<Record>&&)>; >+ using BatchOperationCallback = WTF::Function<void(Vector<uint64_t>&&, Error)>; >+ >+ virtual void open(const String& /* origin */, const String& /* cacheName */, ReportErrorCallback&& callback) { callback(Error::NotImplemented); } >+ virtual void remove(const String& /* origin */, const String& /* cacheName */, ReportErrorCallback&& callback) { callback(Error::NotImplemented); } >+ virtual void refreshCacheMap(const String& /* origin */, CacheMapCallback&& callback) { callback({ }); } >+ >+ virtual void refreshRecords(const String& /* origin */, const String& /* cacheName */, RecordsCallback&& callback) { callback({ }); } >+ virtual void batchDeleteOperation(const String& /* origin */, const String& /* cacheName */, const ResourceRequest&, CacheQueryOptions&&, BatchOperationCallback&& callback) { callback({ }, Error::NotImplemented); } >+ virtual void batchPutOperation(const String& /* origin */, const String& /* cacheName */, Record&&, BatchOperationCallback&& callback) { callback({ }, Error::NotImplemented); } >+}; >+ >+} // namespace WebCore >+ >diff --git a/Source/WebCore/Modules/cache/CacheStorageRecord.h b/Source/WebCore/Modules/cache/CacheStorageRecord.h >new file mode 100644 >index 0000000000000000000000000000000000000000..00a6ace4ba4c091dc09a5d455df6ac7ca5caa27b >--- /dev/null >+++ b/Source/WebCore/Modules/cache/CacheStorageRecord.h >@@ -0,0 +1,40 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "FetchRequest.h" >+#include "FetchResponse.h" >+ >+namespace WebCore { >+ >+struct CacheStorageRecord { >+ uint64_t identifier; >+ >+ Ref<FetchRequest> request; >+ Ref<FetchResponse> response; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/Modules/cache/DOMWindowCaches.cpp b/Source/WebCore/Modules/cache/DOMWindowCaches.cpp >index 8665c55672ea5f46b09d4f9b075a6962c5951ed1..a8a2667baa5251aeda065d8483862553d505856d 100644 >--- a/Source/WebCore/Modules/cache/DOMWindowCaches.cpp >+++ b/Source/WebCore/Modules/cache/DOMWindowCaches.cpp >@@ -27,7 +27,11 @@ > #include "DOMWindowCaches.h" > > #include "CacheStorage.h" >+#include "CacheStorageProvider.h" > #include "DOMWindow.h" >+#include "Document.h" >+#include "Frame.h" >+#include "Page.h" > > namespace WebCore { > >@@ -59,8 +63,8 @@ CacheStorage* DOMWindowCaches::caches(DOMWindow& window) > > CacheStorage* DOMWindowCaches::caches() const > { >- if (!m_caches && frame()) >- m_caches = CacheStorage::create(); >+ if (!m_caches && frame() && frame()->page() && frame()->document()) >+ m_caches = CacheStorage::create(*frame()->document(), frame()->page()->cacheStorageProvider().createCacheStorageConnection(frame()->page()->sessionID())); > return m_caches.get(); > } > >diff --git a/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.cpp b/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.cpp >index 051698e7c6e5790cd270a3180ffeb43c7d7deaaa..c539cde63b4b4d2771c69cff7d59b7f12585b819 100644 >--- a/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.cpp >+++ b/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.cpp >@@ -40,7 +40,7 @@ WorkerGlobalScopeCaches* WorkerGlobalScopeCaches::from(WorkerGlobalScope& scope) > { > auto* supplement = static_cast<WorkerGlobalScopeCaches*>(Supplement<WorkerGlobalScope>::from(&scope, supplementName())); > if (!supplement) { >- auto newSupplement = std::make_unique<WorkerGlobalScopeCaches>(); >+ auto newSupplement = std::make_unique<WorkerGlobalScopeCaches>(scope); > supplement = newSupplement.get(); > provideTo(&scope, supplementName(), WTFMove(newSupplement)); > } >@@ -55,7 +55,7 @@ CacheStorage* WorkerGlobalScopeCaches::caches(WorkerGlobalScope& scope) > CacheStorage* WorkerGlobalScopeCaches::caches() const > { > if (!m_caches) >- m_caches = CacheStorage::create(); >+ m_caches = CacheStorage::create(m_scope, CacheStorageConnection::create()); > return m_caches.get(); > } > >diff --git a/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.h b/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.h >index 795ebd619e2421d4ceb1b78cdee433e12351486d..f6cc851e085e1d3a5c23cac6eb7d3e6fac397640 100644 >--- a/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.h >+++ b/Source/WebCore/Modules/cache/WorkerGlobalScopeCaches.h >@@ -34,7 +34,7 @@ class WorkerGlobalScope; > > class WorkerGlobalScopeCaches : public Supplement<WorkerGlobalScope> { > public: >- WorkerGlobalScopeCaches() = default; >+ WorkerGlobalScopeCaches(WorkerGlobalScope& scope) : m_scope(scope) { }; > > static CacheStorage* caches(WorkerGlobalScope&); > >@@ -43,6 +43,7 @@ private: > static const char* supplementName(); > CacheStorage* caches() const; > >+ WorkerGlobalScope& m_scope; > mutable RefPtr<CacheStorage> m_caches; > }; > >diff --git a/Source/WebCore/Modules/fetch/FetchBodyOwner.h b/Source/WebCore/Modules/fetch/FetchBodyOwner.h >index c3213e972139300d4a51854c0559ab55014a955b..71afc46ce051e4a84e31ac93448396c8f861e19c 100644 >--- a/Source/WebCore/Modules/fetch/FetchBodyOwner.h >+++ b/Source/WebCore/Modules/fetch/FetchBodyOwner.h >@@ -57,6 +57,8 @@ public: > > bool isActive() const { return !!m_blobLoader; } > >+ bool isReadableStreamBody() const { return m_body && m_body->isReadableStream(); } >+ > protected: > const FetchBody& body() const { return *m_body; } > FetchBody& body() { return *m_body; } >diff --git a/Source/WebCore/Modules/fetch/FetchHeaders.h b/Source/WebCore/Modules/fetch/FetchHeaders.h >index fc3b108b9a2d5ae5837c23c791fe209cb68332c8..fee1f8f1f38093b0d335b918d91dce44fcd97d18 100644 >--- a/Source/WebCore/Modules/fetch/FetchHeaders.h >+++ b/Source/WebCore/Modules/fetch/FetchHeaders.h >@@ -30,6 +30,7 @@ > > #include "ExceptionOr.h" > #include "HTTPHeaderMap.h" >+#include <wtf/EnumTraits.h> > #include <wtf/HashTraits.h> > #include <wtf/Variant.h> > #include <wtf/Vector.h> >@@ -49,7 +50,7 @@ public: > using Init = Variant<Vector<Vector<String>>, Vector<WTF::KeyValuePair<String, String>>>; > static ExceptionOr<Ref<FetchHeaders>> create(std::optional<Init>&&); > >- static Ref<FetchHeaders> create(Guard guard = Guard::None) { return adoptRef(*new FetchHeaders { guard }); } >+ static Ref<FetchHeaders> create(Guard guard = Guard::None, HTTPHeaderMap&& headers = { }) { return adoptRef(*new FetchHeaders { guard, WTFMove(headers) }); } > static Ref<FetchHeaders> create(const FetchHeaders& headers) { return adoptRef(*new FetchHeaders { headers }); } > > ExceptionOr<void> append(const String& name, const String& value); >@@ -82,9 +83,10 @@ public: > const HTTPHeaderMap& internalHeaders() const { return m_headers; } > > void setGuard(Guard); >+ Guard guard() const { return m_guard; } > > private: >- explicit FetchHeaders(Guard guard, HTTPHeaderMap&& headers = { }); >+ FetchHeaders(Guard, HTTPHeaderMap&&); > FetchHeaders(const FetchHeaders&); > > Guard m_guard; >@@ -111,3 +113,18 @@ inline void FetchHeaders::setGuard(Guard guard) > } > > } // namespace WebCore >+ >+namespace WTF { >+ >+template<> struct EnumTraits<WebCore::FetchHeaders::Guard> { >+ using values = EnumValues< >+ WebCore::FetchHeaders::Guard, >+ WebCore::FetchHeaders::Guard::None, >+ WebCore::FetchHeaders::Guard::Immutable, >+ WebCore::FetchHeaders::Guard::Request, >+ WebCore::FetchHeaders::Guard::RequestNoCors, >+ WebCore::FetchHeaders::Guard::Response >+ >; >+}; >+ >+} >diff --git a/Source/WebCore/Modules/fetch/FetchLoader.cpp b/Source/WebCore/Modules/fetch/FetchLoader.cpp >index e3a51f1ae84392bf30fc8b5d33531a09db85ccac..edfac5c38591d99e88ed0fdf36e8dc4d8958d624 100644 >--- a/Source/WebCore/Modules/fetch/FetchLoader.cpp >+++ b/Source/WebCore/Modules/fetch/FetchLoader.cpp >@@ -80,7 +80,7 @@ void FetchLoader::start(ScriptExecutionContext& context, const FetchRequest& req > options.dataBufferingPolicy = DoNotBufferData; > options.sameOriginDataURLFlag = SameOriginDataURLFlag::Set; > >- ResourceRequest fetchRequest = request.internalRequest(); >+ ResourceRequest fetchRequest = request.resourceRequest(); > > ASSERT(context.contentSecurityPolicy()); > auto& contentSecurityPolicy = *context.contentSecurityPolicy(); >diff --git a/Source/WebCore/Modules/fetch/FetchRequest.cpp b/Source/WebCore/Modules/fetch/FetchRequest.cpp >index e66c15c994ce51edd5493ad258742dde68ca3d4b..8d0c238783baf0384d27c4d48f617c6102769e83 100644 >--- a/Source/WebCore/Modules/fetch/FetchRequest.cpp >+++ b/Source/WebCore/Modules/fetch/FetchRequest.cpp >@@ -74,7 +74,7 @@ static std::optional<Exception> setReferrer(FetchRequest::InternalRequest& reque > > static std::optional<Exception> buildOptions(FetchRequest::InternalRequest& request, ScriptExecutionContext& context, const FetchRequest::Init& init) > { >- if (!init.window.isUndefinedOrNull()) >+ if (!init.window.isUndefinedOrNull() && !init.window.isEmpty()) > return Exception { TypeError, ASCIILiteral("Window can only be null.") }; > > if (!init.referrer.isNull()) { >@@ -264,7 +264,7 @@ const String& FetchRequest::url() const > return m_requestURL; > } > >-ResourceRequest FetchRequest::internalRequest() const >+ResourceRequest FetchRequest::resourceRequest() const > { > ASSERT(scriptExecutionContext()); > >diff --git a/Source/WebCore/Modules/fetch/FetchRequest.h b/Source/WebCore/Modules/fetch/FetchRequest.h >index 1f0b16e8a5a179f0feac0b597dd58749faedabdd..61dcd2c58633097d1e62e6c5a91eb10021779c34 100644 >--- a/Source/WebCore/Modules/fetch/FetchRequest.h >+++ b/Source/WebCore/Modules/fetch/FetchRequest.h >@@ -53,11 +53,19 @@ public: > using Redirect = FetchOptions::Redirect; > using Type = FetchOptions::Type; > >+ struct InternalRequest { >+ ResourceRequest request; >+ FetchOptions options; >+ String referrer; >+ }; >+ > static ExceptionOr<Ref<FetchRequest>> create(ScriptExecutionContext&, Info&&, Init&&); >+ static Ref<FetchRequest> create(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, InternalRequest&& request) { return adoptRef(*new FetchRequest(context, WTFMove(body), WTFMove(headers), WTFMove(request))); } > > const String& method() const { return m_internalRequest.request.httpMethod(); } > const String& url() const; > FetchHeaders& headers() { return m_headers.get(); } >+ const FetchHeaders& headers() const { return m_headers.get(); } > > Type type() const; > Destination destination() const; >@@ -73,17 +81,14 @@ public: > > ExceptionOr<Ref<FetchRequest>> clone(ScriptExecutionContext&); > >- struct InternalRequest { >- ResourceRequest request; >- FetchOptions options; >- String referrer; >- }; >+ const InternalRequest& internalRequest() const { return m_internalRequest; } > > const FetchOptions& fetchOptions() const { return m_internalRequest.options; } >- ResourceRequest internalRequest() const; >+ ResourceRequest resourceRequest() const; > bool isBodyReadableStream() const { return !isBodyNull() && body().isReadableStream(); } > > const String& internalRequestReferrer() const { return m_internalRequest.referrer; } >+ const URL& internalRequestURL() const { return m_internalRequest.request.url(); } > > private: > FetchRequest(ScriptExecutionContext&, std::optional<FetchBody>&&, Ref<FetchHeaders>&&, InternalRequest&&); >diff --git a/Source/WebCore/Modules/fetch/FetchResponse.cpp b/Source/WebCore/Modules/fetch/FetchResponse.cpp >index 68adb559fe9530f7456dc96f9884b7ffdd6a81be..c6da111b1958741635f1320392e4c6ab78239fb4 100644 >--- a/Source/WebCore/Modules/fetch/FetchResponse.cpp >+++ b/Source/WebCore/Modules/fetch/FetchResponse.cpp >@@ -355,6 +355,14 @@ void FetchResponse::cancel() > > #endif > >+RefPtr<FormData> FetchResponse::bodyForInternalResponse() >+{ >+ ASSERT(!m_isDisturbed); >+ m_isDisturbed = true; >+ return body().bodyForInternalRequest(*scriptExecutionContext()); >+ >+} >+ > void FetchResponse::stop() > { > RefPtr<FetchResponse> protectedThis(this); >diff --git a/Source/WebCore/Modules/fetch/FetchResponse.h b/Source/WebCore/Modules/fetch/FetchResponse.h >index f9b02fb0e587ab4eb3d559794b391f79f5a1dc66..996b89e6cf27bf42274eed07fea70102cece38f0 100644 >--- a/Source/WebCore/Modules/fetch/FetchResponse.h >+++ b/Source/WebCore/Modules/fetch/FetchResponse.h >@@ -57,6 +57,8 @@ public: > static Ref<FetchResponse> error(ScriptExecutionContext&); > static ExceptionOr<Ref<FetchResponse>> redirect(ScriptExecutionContext&, const String& url, int status); > >+ static Ref<FetchResponse> create(ScriptExecutionContext& context, std::optional<FetchBody>&& body, Ref<FetchHeaders>&& headers, ResourceResponse&& response) { return adoptRef(*new FetchResponse(context, WTFMove(body), WTFMove(headers), WTFMove(response))); } >+ > using FetchPromise = DOMPromiseDeferred<IDLInterface<FetchResponse>>; > static void fetch(ScriptExecutionContext&, FetchRequest&, FetchPromise&&); > >@@ -78,6 +80,7 @@ public: > bool ok() const { return m_response.isSuccessful(); } > const String& statusText() const { return m_response.httpStatusText(); } > >+ const FetchHeaders& headers() const { return m_headers; } > FetchHeaders& headers() { return m_headers; } > Ref<FetchResponse> cloneForJS(); > >@@ -90,6 +93,10 @@ public: > > bool isLoading() const { return !!m_bodyLoader; } > >+ RefPtr<FormData> bodyForInternalResponse(); >+ >+ const ResourceResponse& response() const { return m_response; } >+ > private: > FetchResponse(ScriptExecutionContext&, std::optional<FetchBody>&&, Ref<FetchHeaders>&&, ResourceResponse&&); > >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 4b4070a0afb59b1a2da26ad18b6ff791ace7ac49..685cb41b73f14202d972d7250e04cbee8b754bd4 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -1784,6 +1784,14 @@ > 41CF8BE71D46226700707DC9 /* FetchBodyConsumer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41CF8BE41D46222000707DC9 /* FetchBodyConsumer.cpp */; }; > 41D015CA0F4B5C71004A662F /* ContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D015C80F4B5C71004A662F /* ContentType.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 41D015CB0F4B5C71004A662F /* ContentType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41D015C90F4B5C71004A662F /* ContentType.cpp */; }; >+ 41D129CE1F3D0EF600D15E47 /* WorkerGlobalScopeCaches.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FB278D1F34C28200795487 /* WorkerGlobalScopeCaches.h */; }; >+ 41D129CF1F3D0EFE00D15E47 /* CacheStorageConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41D129C91F3D0EE300D15E47 /* CacheStorageConnection.cpp */; }; >+ 41D129D01F3D0F0500D15E47 /* CacheQueryOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FB279B1F34CEF000795487 /* CacheQueryOptions.h */; }; >+ 41D129D11F3D0F0E00D15E47 /* DOMWindowCaches.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FB278C1F34C28200795487 /* DOMWindowCaches.h */; }; >+ 41D129D21F3D0F1200D15E47 /* CacheStorageRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D129CA1F3D0EE300D15E47 /* CacheStorageRecord.h */; }; >+ 41D129D31F3D0F1600D15E47 /* CacheStorageConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D129CC1F3D0EE300D15E47 /* CacheStorageConnection.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 41D129D51F3D0F6900D15E47 /* CacheStorageProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D129D41F3D0F6600D15E47 /* CacheStorageProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 41D129DB1F3D143800D15E47 /* FetchHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F54F831C50C4F600338488 /* FetchHeaders.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 41DEFCB51E56C1BD000D9E5F /* JSDOMMapLike.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DEFCB31E56C1B9000D9E5F /* JSDOMMapLike.cpp */; }; > 41DEFCB61E56C1BD000D9E5F /* JSDOMMapLike.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DEFCB41E56C1B9000D9E5F /* JSDOMMapLike.h */; }; > 41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41E1B1CA0FF5986900576B3B /* AbstractWorker.cpp */; }; >@@ -9436,6 +9444,11 @@ > 41CF8BE61D46222C00707DC9 /* FetchInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FetchInternals.js; sourceTree = "<group>"; }; > 41D015C80F4B5C71004A662F /* ContentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentType.h; sourceTree = "<group>"; }; > 41D015C90F4B5C71004A662F /* ContentType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentType.cpp; sourceTree = "<group>"; }; >+ 41D129C91F3D0EE300D15E47 /* CacheStorageConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageConnection.cpp; sourceTree = "<group>"; }; >+ 41D129CA1F3D0EE300D15E47 /* CacheStorageRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageRecord.h; sourceTree = "<group>"; }; >+ 41D129CB1F3D0EE300D15E47 /* CacheStorage.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = CacheStorage.js; sourceTree = "<group>"; }; >+ 41D129CC1F3D0EE300D15E47 /* CacheStorageConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageConnection.h; sourceTree = "<group>"; }; >+ 41D129D41F3D0F6600D15E47 /* CacheStorageProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheStorageProvider.h; sourceTree = "<group>"; }; > 41D51BB21E4E2E8100131A5B /* LibWebRTCAudioFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCAudioFormat.h; path = libwebrtc/LibWebRTCAudioFormat.h; sourceTree = "<group>"; }; > 41DEFCB21E56C1B9000D9E5F /* JSDOMBindingInternals.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = JSDOMBindingInternals.js; sourceTree = "<group>"; }; > 41DEFCB31E56C1B9000D9E5F /* JSDOMMapLike.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMMapLike.cpp; sourceTree = "<group>"; }; >@@ -17620,6 +17633,10 @@ > 41380C211F34368D00155FDA /* CacheStorage.cpp */, > 41380C221F34369000155FDA /* CacheStorage.h */, > 41380C241F34369700155FDA /* CacheStorage.idl */, >+ 41D129CB1F3D0EE300D15E47 /* CacheStorage.js */, >+ 41D129C91F3D0EE300D15E47 /* CacheStorageConnection.cpp */, >+ 41D129CC1F3D0EE300D15E47 /* CacheStorageConnection.h */, >+ 41D129CA1F3D0EE300D15E47 /* CacheStorageRecord.h */, > 41FB278E1F34C28200795487 /* DOMWindowCaches.cpp */, > 41FB278C1F34C28200795487 /* DOMWindowCaches.h */, > 41380C2B1F343E2F00155FDA /* DOMWindowCaches.idl */, >@@ -18579,12 +18596,12 @@ > 5182C2521F3142500059BA7C /* JSServiceWorker.h */, > 5182C2511F3142500059BA7C /* JSServiceWorkerContainer.cpp */, > 5182C2541F3142500059BA7C /* JSServiceWorkerContainer.h */, >- 51F175001F358B3600C74950 /* JSServiceWorkerUpdateViaCache.cpp */, >- 51F175011F358B3600C74950 /* JSServiceWorkerUpdateViaCache.h */, > 5182C24E1F3142500059BA7C /* JSServiceWorkerGlobalScope.cpp */, > 5182C24D1F3142500059BA7C /* JSServiceWorkerGlobalScope.h */, > 5182C24F1F3142500059BA7C /* JSServiceWorkerRegistration.cpp */, > 5182C2501F3142500059BA7C /* JSServiceWorkerRegistration.h */, >+ 51F175001F358B3600C74950 /* JSServiceWorkerUpdateViaCache.cpp */, >+ 51F175011F358B3600C74950 /* JSServiceWorkerUpdateViaCache.h */, > ); > name = ServiceWorkers; > path = DerivedSources; >@@ -19189,6 +19206,7 @@ > BC124EE60C2641CD009E2349 /* BarProp.idl */, > 460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */, > 460BB6141D0A1BEC00221812 /* Base64Utilities.h */, >+ 41D129D41F3D0F6600D15E47 /* CacheStorageProvider.h */, > 072CA86016CB4DC3008AE131 /* CaptionUserPreferences.cpp */, > 079D0867162F20E800DB8658 /* CaptionUserPreferences.h */, > 079D086A162F21F900DB8658 /* CaptionUserPreferencesMediaAF.cpp */, >@@ -26675,7 +26693,11 @@ > 0753860314489E9800B78452 /* CachedTextTrack.h in Headers */, > BCB16C280979C3BD00467741 /* CachedXSLStyleSheet.h in Headers */, > 93F1995008245E59001E9ABC /* CachePolicy.h in Headers */, >+ 41D129D01F3D0F0500D15E47 /* CacheQueryOptions.h in Headers */, > 41380C291F3436AC00155FDA /* CacheStorage.h in Headers */, >+ 41D129D31F3D0F1600D15E47 /* CacheStorageConnection.h in Headers */, >+ 41D129D51F3D0F6900D15E47 /* CacheStorageProvider.h in Headers */, >+ 41D129D21F3D0F1200D15E47 /* CacheStorageRecord.h in Headers */, > E43AF8E71AC5B7EC00CA717E /* CacheValidation.h in Headers */, > 49AE2D97134EE5F90072920A /* CalculationValue.h in Headers */, > 7C1E8D011ED0C2DA00B1D983 /* CallbackResult.h in Headers */, >@@ -27147,6 +27169,7 @@ > 2E37DFDB12DBAFB800A6B233 /* DOMURL.h in Headers */, > CD9DE18217AAD6A400EA386D /* DOMURLMediaSource.h in Headers */, > 1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */, >+ 41D129D11F3D0F0E00D15E47 /* DOMWindowCaches.h in Headers */, > 51FA2D78152132B300C1BA0B /* DOMWindowExtension.h in Headers */, > 5185FC751BB4C4E80012898F /* DOMWindowIndexedDatabase.h in Headers */, > 97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */, >@@ -27242,6 +27265,7 @@ > 84730D851248F0B300D3A9C9 /* FEMorphology.h in Headers */, > 84730D871248F0B300D3A9C9 /* FEOffset.h in Headers */, > 84730D891248F0B300D3A9C9 /* FESpecularLighting.h in Headers */, >+ 41D129DB1F3D143800D15E47 /* FetchHeaders.h in Headers */, > 416E6FE81BBD12DF000A6023 /* FetchInternalsBuiltins.h in Headers */, > 41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */, > 7CE1914D1F2A9AFB00272F78 /* FetchReferrerPolicy.h in Headers */, >@@ -27375,7 +27399,6 @@ > 316BDBF71E762AD500DE0D5A /* GPUDepthStencilDescriptor.h in Headers */, > 316BDBF01E76292000DE0D5A /* GPUDepthStencilState.h in Headers */, > 316BDB861E6E0A2700DE0D5A /* GPUDevice.h in Headers */, >- 51F174FE1F35899200C74950 /* WorkerType.h in Headers */, > 316BDBCD1E75F18400DE0D5A /* GPUDrawable.h in Headers */, > 316BDBFB1E762D0400DE0D5A /* GPUEnums.h in Headers */, > 316BDB951E70C89700DE0D5A /* GPUFunction.h in Headers */, >@@ -27463,7 +27486,6 @@ > A871D45C0A127CBC00B12A68 /* HTMLEmbedElement.h in Headers */, > 977B386A122883E900B81FF8 /* HTMLEntityParser.h in Headers */, > 977B386C122883E900B81FF8 /* HTMLEntitySearch.h in Headers */, >- 51F174FF1F35899700C74950 /* ServiceWorkerUpdateViaCache.h in Headers */, > 977B386D122883E900B81FF8 /* HTMLEntityTable.h in Headers */, > A81369D4097374F600D74463 /* HTMLFieldSetElement.h in Headers */, > A8CFF7A60A156978000A4234 /* HTMLFontElement.h in Headers */, >@@ -28211,6 +28233,7 @@ > 5182C2581F3143CD0059BA7C /* JSServiceWorkerContainer.h in Headers */, > 5182C25A1F3143CD0059BA7C /* JSServiceWorkerGlobalScope.h in Headers */, > 5182C25C1F3143CD0059BA7C /* JSServiceWorkerRegistration.h in Headers */, >+ 51F175031F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.h in Headers */, > 9BDA64D81B975CF2009C4387 /* JSShadowRoot.h in Headers */, > 46DFF49C1DC2620B00B80B48 /* JSShadowRootMode.h in Headers */, > CD9DE17B17AAC75B00EA386D /* JSSourceBuffer.h in Headers */, >@@ -28410,7 +28433,6 @@ > 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */, > 6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */, > BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */, >- 51F175061F358BF700C74950 /* JSWorkerType.h in Headers */, > 6E3FAD3914733F4011E42307 /* JSWebGLDebugRendererInfo.h in Headers */, > 6E3FAD3914733F4022E42307 /* JSWebGLDebugShaders.h in Headers */, > 6E3FAD3914733F4000E42307 /* JSWebGLDepthTexture.h in Headers */, >@@ -28468,6 +28490,7 @@ > E1C36D350EB0A094007410BC /* JSWorkerGlobalScopeBase.h in Headers */, > E1C362EF0EAF2AA9007410BC /* JSWorkerLocation.h in Headers */, > E1271A580EEECDE400F61213 /* JSWorkerNavigator.h in Headers */, >+ 51F175061F358BF700C74950 /* JSWorkerType.h in Headers */, > 7C4C96DD1AD4483500365A60 /* JSWritableStream.h in Headers */, > 8358CB701C53277500E0C2D8 /* JSXMLDocument.h in Headers */, > BC348BD40DB7F804004ABAB9 /* JSXMLHttpRequest.h in Headers */, >@@ -28689,7 +28712,6 @@ > 413E00791DB0E4F2002341D2 /* MemoryRelease.h in Headers */, > 93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */, > E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */, >- 51F175031F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.h in Headers */, > 75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */, > E1ADECBF0E76ACF1004A1A5E /* MessagePort.h in Headers */, > 41BF700C0FE86F49005E8DEC /* MessagePortChannel.h in Headers */, >@@ -29368,6 +29390,7 @@ > 5182C2411F313A090059BA7C /* ServiceWorkerContainer.h in Headers */, > 5182C2431F313A090059BA7C /* ServiceWorkerGlobalScope.h in Headers */, > 5182C2451F313A090059BA7C /* ServiceWorkerRegistration.h in Headers */, >+ 51F174FF1F35899700C74950 /* ServiceWorkerUpdateViaCache.h in Headers */, > 756B2CE118B7101600FECFAA /* SessionID.h in Headers */, > 93309E10099E64920056E581 /* SetNodeAttributeCommand.h in Headers */, > B8DBDB4C130B0F8A00F5CDB1 /* SetSelectionCommand.h in Headers */, >@@ -30152,6 +30175,7 @@ > A52A68661DBD4B5D0083373F /* WorkerDebuggerAgent.h in Headers */, > A3E2643114748991005A8588 /* WorkerEventQueue.h in Headers */, > 2E4346490F546A8200B0F1BA /* WorkerGlobalScope.h in Headers */, >+ 41D129CE1F3D0EF600D15E47 /* WorkerGlobalScopeCaches.h in Headers */, > 5185FCB41BB4C4E80012898F /* WorkerGlobalScopeIndexedDatabase.h in Headers */, > 2E43464B0F546A8200B0F1BA /* WorkerGlobalScopeProxy.h in Headers */, > A54A0C621DB7F8C10017A90B /* WorkerInspectorController.h in Headers */, >@@ -30173,6 +30197,7 @@ > 0B9056F90F2685F30095FF6A /* WorkerThreadableLoader.h in Headers */, > 97AABD2D14FA09D5007457AE /* WorkerThreadableWebSocketChannel.h in Headers */, > A54A0C681DB807D90017A90B /* WorkerToPageFrontendChannel.h in Headers */, >+ 51F174FE1F35899200C74950 /* WorkerType.h in Headers */, > 93309E24099E64920056E581 /* WrapContentsInDummySpanCommand.h in Headers */, > 416E6FE91BBD12E5000A6053 /* WritableStreamBuiltins.h in Headers */, > 416E6FE81BBD12DF000A6053 /* WritableStreamInternalsBuiltins.h in Headers */, >@@ -30763,6 +30788,7 @@ > 0753860214489E9800B78452 /* CachedTextTrack.cpp in Sources */, > BCB16C270979C3BD00467741 /* CachedXSLStyleSheet.cpp in Sources */, > 41380C281F3436AC00155FDA /* CacheStorage.cpp in Sources */, >+ 41D129CF1F3D0EFE00D15E47 /* CacheStorageConnection.cpp in Sources */, > E43AF8E61AC5B7E800CA717E /* CacheValidation.cpp in Sources */, > 49AE2D96134EE5F90072920A /* CalculationValue.cpp in Sources */, > 952076041F2675FE007D2AAB /* CallTracer.cpp in Sources */, >@@ -32044,7 +32070,6 @@ > 12A253E01C8FFF6600C22295 /* JSKeyframeEffect.cpp in Sources */, > 935F45420F7C3B5F00D7C1FB /* JSLazyEventListener.cpp in Sources */, > BCE1C43B0D9830D3003B02F2 /* JSLocation.cpp in Sources */, >- 51F175071F358BF900C74950 /* JSWorkerType.cpp in Sources */, > BCE1C4400D9830F4003B02F2 /* JSLocationCustom.cpp in Sources */, > 93A8061F1E03B585008A1F26 /* JSLongRange.cpp in Sources */, > 8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */, >@@ -32201,6 +32226,7 @@ > 5182C2571F3143CD0059BA7C /* JSServiceWorkerContainer.cpp in Sources */, > 5182C2591F3143CD0059BA7C /* JSServiceWorkerGlobalScope.cpp in Sources */, > 5182C25B1F3143CD0059BA7C /* JSServiceWorkerRegistration.cpp in Sources */, >+ 51F175021F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.cpp in Sources */, > 9BDA64D71B975CE5009C4387 /* JSShadowRoot.cpp in Sources */, > 46DFF49B1DC2620B00B80B48 /* JSShadowRootMode.cpp in Sources */, > CD9DE17A17AAC75B00EA386D /* JSSourceBuffer.cpp in Sources */, >@@ -32483,6 +32509,7 @@ > E18258AC0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp in Sources */, > E1C362F00EAF2AA9007410BC /* JSWorkerLocation.cpp in Sources */, > E1271A590EEECDE400F61213 /* JSWorkerNavigator.cpp in Sources */, >+ 51F175071F358BF900C74950 /* JSWorkerType.cpp in Sources */, > 7C4C96DC1AD4483500365A60 /* JSWritableStream.cpp in Sources */, > 8358CB6F1C53277200E0C2D8 /* JSXMLDocument.cpp in Sources */, > 83A4A9F91CE7FD8100709B00 /* JSXMLDocumentCustom.cpp in Sources */, >@@ -33680,7 +33707,6 @@ > 7AF9B20218CFB2DF00C64BEF /* VTTRegion.cpp in Sources */, > 7AF9B20518CFB2DF00C64BEF /* VTTRegionList.cpp in Sources */, > 7A93868518DCC14500B8263D /* VTTScanner.cpp in Sources */, >- 51F175021F358B3B00C74950 /* JSServiceWorkerUpdateViaCache.cpp in Sources */, > A14832B1187F61E100DA63A6 /* WAKAppKitStubs.m in Sources */, > A14832B3187F629100DA63A6 /* WAKClipView.m in Sources */, > A14832B5187F62FC00DA63A6 /* WAKResponder.m in Sources */, >diff --git a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >index 09fe81ba47ca53c8775cb6627a76d3b3e26279eb..722ea2e48e1f33e2360bdb60056c002f9c4b4276 100644 >--- a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >+++ b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >@@ -38,6 +38,8 @@ namespace WebCore { > macro(backingMap) \ > macro(body) \ > macro(byobRequest) \ >+ macro(cacheMap) \ >+ macro(cacheName) \ > macro(cancel) \ > macro(cloneArrayBuffer) \ > macro(cloneForJS) \ >@@ -63,6 +65,7 @@ namespace WebCore { > macro(localStreams) \ > macro(makeThisTypeError) \ > macro(makeGetterTypeError) \ >+ macro(matchAll) \ > macro(mediaStreamTrackConstraints) \ > macro(operations) \ > macro(ownerReadableStream) \ >@@ -113,6 +116,8 @@ namespace WebCore { > macro(view) \ > macro(webRTCLegacyAPIEnabled) \ > macro(writing) \ >+ macro(Cache) \ >+ macro(CacheStorage) \ > macro(Headers) \ > macro(MediaStream) \ > macro(MediaStreamTrack) \ >diff --git a/Source/WebCore/inspector/InspectorOverlay.cpp b/Source/WebCore/inspector/InspectorOverlay.cpp >index 66c7f08f0f28b046bb4c35e8e9bf19fbdf2abc55..2a813b6a120df358f08bd2718c965734301def49 100644 >--- a/Source/WebCore/inspector/InspectorOverlay.cpp >+++ b/Source/WebCore/inspector/InspectorOverlay.cpp >@@ -29,6 +29,7 @@ > #include "config.h" > #include "InspectorOverlay.h" > >+#include "CacheStorageProvider.h" > #include "DocumentLoader.h" > #include "EditorClient.h" > #include "Element.h" >@@ -865,7 +866,8 @@ Page* InspectorOverlay::overlayPage() > PageConfiguration pageConfiguration( > createEmptyEditorClient(), > SocketProvider::create(), >- makeUniqueRef<LibWebRTCProvider>() >+ makeUniqueRef<LibWebRTCProvider>(), >+ CacheStorageProvider::create() > ); > fillWithEmptyClients(pageConfiguration); > m_overlayPage = std::make_unique<Page>(WTFMove(pageConfiguration)); >diff --git a/Source/WebCore/page/CacheStorageProvider.h b/Source/WebCore/page/CacheStorageProvider.h >new file mode 100644 >index 0000000000000000000000000000000000000000..00bf1dc5cd1f8fbcc661cf1d6c00a4a8cc2c88ab >--- /dev/null >+++ b/Source/WebCore/page/CacheStorageProvider.h >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "CacheStorageConnection.h" >+#include "SessionID.h" >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class WEBCORE_EXPORT CacheStorageProvider : public RefCounted<CacheStorageProvider> { >+public: >+ static Ref<CacheStorageProvider> create() { return adoptRef(*new CacheStorageProvider); } >+ virtual Ref<CacheStorageConnection> createCacheStorageConnection(SessionID) { return CacheStorageConnection::create(); } >+ virtual ~CacheStorageProvider() { }; >+}; >+ >+} >diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp >index c26987f8dcb2e9e9606daa972d2cfcc7becc5fb7..7041f1cf295954eaff04d6b8a6164f8faac0d676 100644 >--- a/Source/WebCore/page/Page.cpp >+++ b/Source/WebCore/page/Page.cpp >@@ -26,6 +26,7 @@ > #include "BackForwardClient.h" > #include "BackForwardController.h" > #include "CSSAnimationController.h" >+#include "CacheStorageProvider.h" > #include "Chrome.h" > #include "ChromeClient.h" > #include "ConstantPropertyMap.h" >@@ -222,6 +223,7 @@ Page::Page(PageConfiguration&& pageConfiguration) > #endif > , m_socketProvider(WTFMove(pageConfiguration.socketProvider)) > , m_applicationCacheStorage(*WTFMove(pageConfiguration.applicationCacheStorage)) >+ , m_cacheStorageProvider(WTFMove(pageConfiguration.cacheStorageProvider)) > , m_databaseProvider(*WTFMove(pageConfiguration.databaseProvider)) > , m_pluginInfoProvider(*WTFMove(pageConfiguration.pluginInfoProvider)) > , m_storageNamespaceProvider(*WTFMove(pageConfiguration.storageNamespaceProvider)) >diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h >index 909f37902d33e1d0ef3e5a9b4f64bab4dfa5ff0b..5fc89cdc592c949eb18d9cea17f61fbcd3551203 100644 >--- a/Source/WebCore/page/Page.h >+++ b/Source/WebCore/page/Page.h >@@ -77,6 +77,7 @@ class AlternativeTextClient; > class ApplicationCacheStorage; > class BackForwardController; > class BackForwardClient; >+class CacheStorageProvider; > class Chrome; > class ChromeClient; > class Color; >@@ -510,6 +511,7 @@ public: > > ApplicationCacheStorage& applicationCacheStorage() { return m_applicationCacheStorage; } > DatabaseProvider& databaseProvider() { return m_databaseProvider; } >+ CacheStorageProvider& cacheStorageProvider() { return m_cacheStorageProvider; } > SocketProvider& socketProvider() { return m_socketProvider; } > > StorageNamespaceProvider& storageNamespaceProvider() { return m_storageNamespaceProvider.get(); } >@@ -784,6 +786,7 @@ private: > > Ref<SocketProvider> m_socketProvider; > Ref<ApplicationCacheStorage> m_applicationCacheStorage; >+ Ref<CacheStorageProvider> m_cacheStorageProvider; > Ref<DatabaseProvider> m_databaseProvider; > Ref<PluginInfoProvider> m_pluginInfoProvider; > Ref<StorageNamespaceProvider> m_storageNamespaceProvider; >diff --git a/Source/WebCore/page/PageConfiguration.cpp b/Source/WebCore/page/PageConfiguration.cpp >index 1123dd6d405a94813a4a78742c7d66d2cf1bee7c..f1b827dcfbaae6e6c8dccad9d18d49379dc951c4 100644 >--- a/Source/WebCore/page/PageConfiguration.cpp >+++ b/Source/WebCore/page/PageConfiguration.cpp >@@ -28,6 +28,7 @@ > > #include "ApplicationCacheStorage.h" > #include "BackForwardClient.h" >+#include "CacheStorageProvider.h" > #include "DatabaseProvider.h" > #include "DiagnosticLoggingClient.h" > #include "EditorClient.h" >@@ -43,10 +44,11 @@ > > namespace WebCore { > >-PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider) >+PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider, Ref<CacheStorageProvider>&& cacheStorageProvider) > : editorClient(WTFMove(editorClient)) > , socketProvider(WTFMove(socketProvider)) > , libWebRTCProvider(WTFMove(libWebRTCProvider)) >+ , cacheStorageProvider(WTFMove(cacheStorageProvider)) > { > } > >diff --git a/Source/WebCore/page/PageConfiguration.h b/Source/WebCore/page/PageConfiguration.h >index f53a12c387eafb404f2a066602759ec9a7fc0f5f..a862d4302e036464f910a57b01d77b64cc6ef425 100644 >--- a/Source/WebCore/page/PageConfiguration.h >+++ b/Source/WebCore/page/PageConfiguration.h >@@ -34,6 +34,7 @@ namespace WebCore { > class AlternativeTextClient; > class ApplicationCacheStorage; > class BackForwardClient; >+class CacheStorageProvider; > class ChromeClient; > class ContextMenuClient; > class DatabaseProvider; >@@ -58,7 +59,7 @@ class WebGLStateTracker; > class PageConfiguration { > WTF_MAKE_NONCOPYABLE(PageConfiguration); WTF_MAKE_FAST_ALLOCATED; > public: >- WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&); >+ WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&, Ref<CacheStorageProvider>&&); > WEBCORE_EXPORT ~PageConfiguration(); > > AlternativeTextClient* alternativeTextClient { nullptr }; >@@ -87,6 +88,7 @@ public: > > RefPtr<ApplicationCacheStorage> applicationCacheStorage; > RefPtr<DatabaseProvider> databaseProvider; >+ Ref<CacheStorageProvider> cacheStorageProvider; > RefPtr<PluginInfoProvider> pluginInfoProvider; > RefPtr<StorageNamespaceProvider> storageNamespaceProvider; > RefPtr<UserContentProvider> userContentProvider; >diff --git a/Source/WebCore/style/StyleUpdate.h b/Source/WebCore/style/StyleUpdate.h >index 559d2d4ad7b4fdfb430c07d1196381c5b015d691..708155d1c2ad6a3027a7638ad6d200d29cfc9c74 100644 >--- a/Source/WebCore/style/StyleUpdate.h >+++ b/Source/WebCore/style/StyleUpdate.h >@@ -55,6 +55,12 @@ struct ElementUpdate { > }; > > struct TextUpdate { >+ TextUpdate() = default; >+ TextUpdate(unsigned offset, unsigned length) >+ : offset(offset) >+ , length(length) >+ { } >+ > unsigned offset { 0 }; > unsigned length { std::numeric_limits<unsigned>::max() }; > }; >diff --git a/Source/WebCore/svg/graphics/SVGImage.cpp b/Source/WebCore/svg/graphics/SVGImage.cpp >index 786e8f7a7bca60809a555b65f835c2a50a0082e8..8259b2f8e28663b217cdea04c2f8ec3837cd78f4 100644 >--- a/Source/WebCore/svg/graphics/SVGImage.cpp >+++ b/Source/WebCore/svg/graphics/SVGImage.cpp >@@ -28,6 +28,7 @@ > #include "config.h" > #include "SVGImage.h" > >+#include "CacheStorageProvider.h" > #include "Chrome.h" > #include "CommonVM.h" > #include "DOMWindow.h" >@@ -429,7 +430,8 @@ EncodedDataStatus SVGImage::dataChanged(bool allDataReceived) > PageConfiguration pageConfiguration( > createEmptyEditorClient(), > SocketProvider::create(), >- makeUniqueRef<LibWebRTCProvider>() >+ makeUniqueRef<LibWebRTCProvider>(), >+ CacheStorageProvider::create() > ); > fillWithEmptyClients(pageConfiguration); > m_chromeClient = std::make_unique<SVGImageChromeClient>(this); >diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt >index 334f668b773c86bb2e154c564e8c49bf80bc7664..6aa856dac593511bfa73742842c4e4e0b5d8af0b 100644 >--- a/Source/WebKit/CMakeLists.txt >+++ b/Source/WebKit/CMakeLists.txt >@@ -52,6 +52,7 @@ set(WebKit2_INCLUDE_DIRECTORIES > "${WEBKIT2_DIR}/WebProcess/ApplePay" > "${WEBKIT2_DIR}/WebProcess/ApplicationCache" > "${WEBKIT2_DIR}/WebProcess/Automation" >+ "${WEBKIT2_DIR}/WebProcess/Cache" > "${WEBKIT2_DIR}/WebProcess/Cookies" > "${WEBKIT2_DIR}/WebProcess/Databases" > "${WEBKIT2_DIR}/WebProcess/Databases/IndexedDB" >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 4e3c234e85fb75d2e20e71ef31eaf245dd65ed11..34e3ca2a82420a5996aefac43dcc65fbefa0cc22 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -891,6 +891,7 @@ > 413075B21DE85F580039EC69 /* LibWebRTCSocketFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075A61DE85EE70039EC69 /* LibWebRTCSocketFactory.h */; }; > 413075B31DE85F580039EC69 /* LibWebRTCProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 413075A71DE85EE70039EC69 /* LibWebRTCProvider.cpp */; }; > 413075B41DE85F580039EC69 /* LibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */; }; >+ 41D129DA1F3D101800D15E47 /* WebCacheStorageProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41D129D91F3D101400D15E47 /* WebCacheStorageProvider.h */; }; > 41DC45961E3D6E2200B11F51 /* NetworkRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 41DC45941E3D6E1E00B11F51 /* NetworkRTCProvider.h */; }; > 41DC45971E3D6E2200B11F51 /* NetworkRTCProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DC45951E3D6E1E00B11F51 /* NetworkRTCProvider.cpp */; }; > 41DC459B1E3DBB2800B11F51 /* LibWebRTCSocketClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41DC45991E3DBB2400B11F51 /* LibWebRTCSocketClient.cpp */; }; >@@ -3140,6 +3141,7 @@ > 413075A71DE85EE70039EC69 /* LibWebRTCProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = LibWebRTCProvider.cpp; path = Network/webrtc/LibWebRTCProvider.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; > 413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = LibWebRTCProvider.h; path = Network/webrtc/LibWebRTCProvider.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; > 41AC86811E042E5300303074 /* WebRTCResolver.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; lineEnding = 0; name = WebRTCResolver.messages.in; path = Network/webrtc/WebRTCResolver.messages.in; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = "<none>"; }; >+ 41D129D91F3D101400D15E47 /* WebCacheStorageProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCacheStorageProvider.h; sourceTree = "<group>"; }; > 41DC45941E3D6E1E00B11F51 /* NetworkRTCProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkRTCProvider.h; path = NetworkProcess/webrtc/NetworkRTCProvider.h; sourceTree = "<group>"; }; > 41DC45951E3D6E1E00B11F51 /* NetworkRTCProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkRTCProvider.cpp; path = NetworkProcess/webrtc/NetworkRTCProvider.cpp; sourceTree = "<group>"; }; > 41DC45981E3D6ED600B11F51 /* NetworkRTCProvider.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NetworkRTCProvider.messages.in; path = NetworkProcess/webrtc/NetworkRTCProvider.messages.in; sourceTree = "<group>"; }; >@@ -5908,6 +5910,14 @@ > name = webrtc; > sourceTree = "<group>"; > }; >+ 41D129D81F3D101400D15E47 /* Cache */ = { >+ isa = PBXGroup; >+ children = ( >+ 41D129D91F3D101400D15E47 /* WebCacheStorageProvider.h */, >+ ); >+ path = Cache; >+ sourceTree = "<group>"; >+ }; > 4450AEBE1DC3FAAC009943F2 /* cocoa */ = { > isa = PBXGroup; > children = ( >@@ -6586,6 +6596,7 @@ > children = ( > 1AB1F7701D1B2F5D007C9BD1 /* ApplePay */, > 1C0A19431C8FF1A800FE0EBB /* Automation */, >+ 41D129D81F3D101400D15E47 /* Cache */, > 7C6E70F818B2D47E00F24E2E /* cocoa */, > 3309344B1315B93A0097A7BC /* Cookies */, > 512A9754180DF9270039A149 /* Databases */, >@@ -8683,6 +8694,7 @@ > BC72BA1E11E64907001EB4EA /* WebBackForwardList.h in Headers */, > 518D2CAE12D5153B003BB93B /* WebBackForwardListItem.h in Headers */, > BC72B9FB11E6476B001EB4EA /* WebBackForwardListProxy.h in Headers */, >+ 41D129DA1F3D101800D15E47 /* WebCacheStorageProvider.h in Headers */, > BCF50728124329AA005955AE /* WebCertificateInfo.h in Headers */, > BC032D7510F4378D0058C15A /* WebChromeClient.h in Headers */, > 3F87B9BE158940190090FF62 /* WebColorChooser.h in Headers */, >diff --git a/Source/WebKit/WebProcess/Cache/WebCacheStorageProvider.h b/Source/WebKit/WebProcess/Cache/WebCacheStorageProvider.h >new file mode 100644 >index 0000000000000000000000000000000000000000..a42216a2086ce6880e0e38c16da985b87e0667fa >--- /dev/null >+++ b/Source/WebKit/WebProcess/Cache/WebCacheStorageProvider.h >@@ -0,0 +1,37 @@ >+/* >+ * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <WebCore/CacheStorageProvider.h> >+ >+namespace WebKit { >+ >+class WebCacheStorageProvider final : public WebCore::CacheStorageProvider { >+public: >+ static Ref<WebCacheStorageProvider> create() { return adoptRef(*new WebCacheStorageProvider); } >+}; >+ >+} >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 25c753fa9a974bfa9fead36fdc389a0bd9c0a12c..04fc61533d91a20eb8dae75126d7933f0828cbb3 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -68,6 +68,7 @@ > #include "WebAlternativeTextClient.h" > #include "WebBackForwardListItem.h" > #include "WebBackForwardListProxy.h" >+#include "WebCacheStorageProvider.h" > #include "WebChromeClient.h" > #include "WebColorChooser.h" > #include "WebContextMenu.h" >@@ -371,7 +372,8 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > PageConfiguration pageConfiguration( > makeUniqueRef<WebEditorClient>(this), > WebSocketProvider::create(), >- makeUniqueRef<WebKit::LibWebRTCProvider>() >+ makeUniqueRef<WebKit::LibWebRTCProvider>(), >+ WebProcess::singleton().cacheStorageProvider() > ); > pageConfiguration.chromeClient = new WebChromeClient(*this); > #if ENABLE(CONTEXT_MENUS) >diff --git a/Source/WebKit/WebProcess/WebProcess.cpp b/Source/WebKit/WebProcess/WebProcess.cpp >index 9d16b5077825240a85c45dcd4c98c01b52a99c5b..d0744c1314406c4675288a927faa1c0284d33527 100644 >--- a/Source/WebKit/WebProcess/WebProcess.cpp >+++ b/Source/WebKit/WebProcess/WebProcess.cpp >@@ -44,6 +44,7 @@ > #include "StatisticsData.h" > #include "UserData.h" > #include "WebAutomationSessionProxy.h" >+#include "WebCacheStorageProvider.h" > #include "WebConnectionToUIProcess.h" > #include "WebCookieManager.h" > #include "WebCoreArgumentCoders.h" >@@ -159,6 +160,7 @@ WebProcess::WebProcess() > #endif > , m_webInspectorInterruptDispatcher(WebInspectorInterruptDispatcher::create()) > , m_webLoaderStrategy(*new WebLoaderStrategy) >+ , m_cacheStorageProvider(WebCacheStorageProvider::create()) > , m_dnsPrefetchHystereris([this](HysteresisState state) { if (state == HysteresisState::Stopped) m_dnsPrefetchedHosts.clear(); }) > #if ENABLE(NETSCAPE_PLUGIN_API) > , m_pluginProcessConnectionManager(PluginProcessConnectionManager::create()) >diff --git a/Source/WebKit/WebProcess/WebProcess.h b/Source/WebKit/WebProcess/WebProcess.h >index cf2ab813b3790373b2da0fa6fabf7bac47b2f497..123c4bb198caf70cd976f69599f77790b1d0bb74 100644 >--- a/Source/WebKit/WebProcess/WebProcess.h >+++ b/Source/WebKit/WebProcess/WebProcess.h >@@ -80,6 +80,7 @@ class ObjCObjectGraph; > class UserData; > class WaylandCompositorDisplay; > class WebAutomationSessionProxy; >+class WebCacheStorageProvider; > class WebConnectionToUIProcess; > class WebFrame; > class WebLoaderStrategy; >@@ -222,6 +223,8 @@ public: > > WebAutomationSessionProxy* automationSessionProxy() { return m_automationSessionProxy.get(); } > >+ WebCacheStorageProvider& cacheStorageProvider() { return m_cacheStorageProvider.get(); } >+ > private: > WebProcess(); > ~WebProcess(); >@@ -375,6 +378,8 @@ private: > RefPtr<NetworkProcessConnection> m_networkProcessConnection; > WebLoaderStrategy& m_webLoaderStrategy; > >+ Ref<WebCacheStorageProvider> m_cacheStorageProvider; >+ > #if USE(LIBWEBRTC) > std::unique_ptr<LibWebRTCNetwork> m_libWebRTCNetwork; > #endif >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index 1d49b49f4680931b9e9dd07bfe01082850cc22bf..4492f58d5f5364da0da75020f4e54dfee0206238 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -124,6 +124,7 @@ > #import <WebCore/ApplicationCacheStorage.h> > #import <WebCore/BackForwardController.h> > #import <WebCore/CSSAnimationController.h> >+#import <WebCore/CacheStorageProvider.h> > #import <WebCore/Chrome.h> > #import <WebCore/ColorMac.h> > #import <WebCore/DatabaseManager.h> >@@ -1413,7 +1414,8 @@ static void WebKitInitializeGamepadProviderIfNecessary() > PageConfiguration pageConfiguration( > makeUniqueRef<WebEditorClient>(self), > SocketProvider::create(), >- makeUniqueRef<WebCore::LibWebRTCProvider>() >+ makeUniqueRef<WebCore::LibWebRTCProvider>(), >+ WebCore::CacheStorageProvider::create() > ); > #if !PLATFORM(IOS) > pageConfiguration.chromeClient = new WebChromeClient(self); >@@ -1676,7 +1678,8 @@ static void WebKitInitializeGamepadProviderIfNecessary() > PageConfiguration pageConfiguration( > makeUniqueRef<WebEditorClient>(self), > SocketProvider::create(), >- makeUniqueRef<WebCore::LibWebRTCProvider>() >+ makeUniqueRef<WebCore::LibWebRTCProvider>(), >+ WebCore::CacheStorageProvider::create() > ); > pageConfiguration.chromeClient = new WebChromeClientIOS(self); > #if ENABLE(DRAG_SUPPORT) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 457d114a339e54f4d99d4bda9cb7bf4c1b0fe0a7..00577803591db5b4ca00a6b033f96a3ca5069e90 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,12 @@ >+2017-08-10 Youenn Fablet <youenn@apple.com> >+ >+ [Cache API] Adding generic support for CacheStorage and Cache methods >+ https://bugs.webkit.org/show_bug.cgi?id=175455 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestExpectations: Skipping a test that would timeout otherwise due to the current implementation limitations. >+ > 2017-08-10 Miguel Gomez <magomez@igalia.com> > > Unreviewed GTK+ gardening. Update expectations of several tests failing at r220516. >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index a8be26cd6aaccf572153f83661ff419f3a92942a..08b1bdf2526f24fe43c02a2778996c44cab044e1 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,16 @@ >+2017-08-10 Youenn Fablet <youenn@apple.com> >+ >+ [Cache API] Adding generic support for CacheStorage and Cache methods >+ https://bugs.webkit.org/show_bug.cgi?id=175455 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/service-workers/cache-storage/serviceworker/credentials.https-expected.txt: >+ * web-platform-tests/service-workers/cache-storage/window/cache-storage-match.https-expected.txt: >+ * web-platform-tests/service-workers/cache-storage/window/cache-storage.https-expected.txt: >+ * web-platform-tests/service-workers/cache-storage/worker/cache-storage-match.https-expected.txt: >+ * web-platform-tests/service-workers/cache-storage/worker/cache-storage.https-expected.txt: >+ > 2017-08-09 Chris Dumez <cdumez@apple.com> > > Import beacon/headers/header-content-type.html from upstream WPT >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index e6ad2f25827aeb52bc6341173769397155076a19..69fbf6c4aee10561418448753ba3e91ac5362977 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -121,7 +121,7 @@ imported/w3c/web-platform-tests/service-workers/stub-4.6.2-cache.html [ Pass ] > imported/w3c/web-platform-tests/service-workers/stub-4.6.3-cache-storage.html [ Pass ] > imported/w3c/web-platform-tests/service-workers/cache-storage [ Pass ] > imported/w3c/web-platform-tests/service-workers/cache-storage/window [ Pass Failure ] >- >+imported/w3c/web-platform-tests/service-workers/cache-storage/common.https.html [ Skip ] > > # textarea.animate is not supported > imported/w3c/web-platform-tests/css/css-ui-3/caret-color-018.html [ Skip ] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/credentials.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/credentials.https-expected.txt >index 0761650dbc41e8bd15e64e47e308f2dc32ab9e5b..38e952397c3461928f1ef1edf7abee30ce381277 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/credentials.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/credentials.https-expected.txt >@@ -1,3 +1,3 @@ > >-FAIL Cache API matching includes credentials promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >+FAIL Cache API matching includes credentials assert_unreached: unregister should not fail: serviceWorker.getRegistration() is not yet implemented Reached unreachable code > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-storage-match.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-storage-match.https-expected.txt >index fdeafe9366e9f599947d20359af0a574b3c2d6f3..71f5e70d2b2c36d5574b5311ab0cae6ebc690fed 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-storage-match.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-storage-match.https-expected.txt >@@ -4,8 +4,8 @@ FAIL CacheStorageMatch from one of many caches promise_test: Unhandled rejection > FAIL CacheStorageMatch from one of many caches by name promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL CacheStorageMatch a string request promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL CacheStorageMatch a HEAD request promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >-FAIL CacheStorageMatch with no cached entry promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >-FAIL CacheStorageMatch with no caches available but name provided promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >+PASS CacheStorageMatch with no cached entry >+PASS CacheStorageMatch with no caches available but name provided > FAIL CacheStorageMatch with empty cache name provided promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL CacheStorageMatch supports ignoreSearch promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL Cache.match supports ignoreMethod promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-storage.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-storage.https-expected.txt >index 001e6e33bd7ab34ea735acadf9420cae10829b61..1ad460028da769ec19814e310ad0a0078e3e779e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-storage.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/window/cache-storage.https-expected.txt >@@ -4,9 +4,9 @@ FAIL CacheStorage.delete dooms, but does not delete immediately promise_test: Un > FAIL CacheStorage.open with an empty name promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > PASS CacheStorage.open with no arguments > FAIL CacheStorage.has with existing cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >-FAIL CacheStorage.has with nonexistent cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >+PASS CacheStorage.has with nonexistent cache > FAIL CacheStorage.open with existing cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL CacheStorage.delete with existing cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >-FAIL CacheStorage.delete with nonexistent cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >+PASS CacheStorage.delete with nonexistent cache > FAIL CacheStorage names are DOMStrings not USVStrings promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage-match.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage-match.https-expected.txt >index fdeafe9366e9f599947d20359af0a574b3c2d6f3..71f5e70d2b2c36d5574b5311ab0cae6ebc690fed 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage-match.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage-match.https-expected.txt >@@ -4,8 +4,8 @@ FAIL CacheStorageMatch from one of many caches promise_test: Unhandled rejection > FAIL CacheStorageMatch from one of many caches by name promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL CacheStorageMatch a string request promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL CacheStorageMatch a HEAD request promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >-FAIL CacheStorageMatch with no cached entry promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >-FAIL CacheStorageMatch with no caches available but name provided promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >+PASS CacheStorageMatch with no cached entry >+PASS CacheStorageMatch with no caches available but name provided > FAIL CacheStorageMatch with empty cache name provided promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL CacheStorageMatch supports ignoreSearch promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL Cache.match supports ignoreMethod promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >diff --git a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage.https-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage.https-expected.txt >index 001e6e33bd7ab34ea735acadf9420cae10829b61..1ad460028da769ec19814e310ad0a0078e3e779e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage.https-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/service-workers/cache-storage/worker/cache-storage.https-expected.txt >@@ -4,9 +4,9 @@ FAIL CacheStorage.delete dooms, but does not delete immediately promise_test: Un > FAIL CacheStorage.open with an empty name promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > PASS CacheStorage.open with no arguments > FAIL CacheStorage.has with existing cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >-FAIL CacheStorage.has with nonexistent cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >+PASS CacheStorage.has with nonexistent cache > FAIL CacheStorage.open with existing cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" > FAIL CacheStorage.delete with existing cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >-FAIL CacheStorage.delete with nonexistent cache promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >+PASS CacheStorage.delete with nonexistent cache > FAIL CacheStorage names are DOMStrings not USVStrings promise_test: Unhandled rejection with value: object "TypeError: Not implemented" >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 175455
:
317873
|
317878
|
317890
|
317894
|
317934
|
317937
|
317946
|
317972
|
318017
|
318022
|
318026
|
318090
|
318092
|
318093
|
318113
|
318151