diff --git a/dom/cache/CacheStorage.cpp b/dom/cache/CacheStorage.cpp index 02f3119d277d9c0886da0f49529cf8c2bdf9333e..8ed53a0ce87db663f337055eb8e5916b01f74892 100644 --- a/dom/cache/CacheStorage.cpp +++ b/dom/cache/CacheStorage.cpp @@ -314,7 +314,7 @@ CacheStorage::CacheStorage(nsresult aFailureResult) already_AddRefed<Promise> CacheStorage::Match( JSContext* aCx, const RequestOrUSVString& aRequest, - const CacheQueryOptions& aOptions, ErrorResult& aRv) { + const MultiCacheQueryOptions& aOptions, ErrorResult& aRv) { NS_ASSERT_OWNINGTHREAD(CacheStorage); if (!HasStorageAccess()) { diff --git a/dom/cache/CacheStorage.h b/dom/cache/CacheStorage.h index 5d854731d2a63ffa1f13b3da211b9d01c4456a68..74770216a9c623351b48c6b529a6be012ffd6f44 100644 --- a/dom/cache/CacheStorage.h +++ b/dom/cache/CacheStorage.h @@ -55,7 +55,7 @@ class CacheStorage final : public nsISupports, // webidl interface methods already_AddRefed<Promise> Match(JSContext* aCx, const RequestOrUSVString& aRequest, - const CacheQueryOptions& aOptions, + const MultiCacheQueryOptions& aOptions, ErrorResult& aRv); already_AddRefed<Promise> Has(const nsAString& aKey, ErrorResult& aRv); already_AddRefed<Promise> Open(const nsAString& aKey, ErrorResult& aRv); diff --git a/dom/cache/TypeUtils.cpp b/dom/cache/TypeUtils.cpp index 52d933ae6b257a1fb0ebc637d65f6f8344cfd6fe..83ea0b99ad81a4679453bf0852ac72bb9631d7d4 100644 --- a/dom/cache/TypeUtils.cpp +++ b/dom/cache/TypeUtils.cpp @@ -6,8 +6,10 @@ #include "mozilla/dom/cache/TypeUtils.h" +#include "mozilla/StaticPrefs_extensions.h" #include "mozilla/Unused.h" #include "mozilla/dom/CacheBinding.h" +#include "mozilla/dom/CacheStorageBinding.h" #include "mozilla/dom/FetchTypes.h" #include "mozilla/dom/InternalRequest.h" #include "mozilla/dom/Request.h" @@ -19,16 +21,15 @@ #include "mozilla/ipc/PBackgroundChild.h" #include "mozilla/ipc/PFileDescriptorSetChild.h" #include "mozilla/ipc/InputStreamUtils.h" -#include "mozilla/StaticPrefs_extensions.h" #include "nsCOMPtr.h" +#include "nsCRT.h" +#include "nsHttp.h" #include "nsIIPCSerializableInputStream.h" -#include "nsQueryObject.h" #include "nsPromiseFlatString.h" +#include "nsQueryObject.h" #include "nsStreamUtils.h" #include "nsString.h" #include "nsURLParsers.h" -#include "nsCRT.h" -#include "nsHttp.h" namespace mozilla { namespace dom { @@ -243,6 +244,12 @@ void TypeUtils::ToCacheQueryParams(CacheQueryParams& aOut, aOut.ignoreSearch() = aIn.mIgnoreSearch; aOut.ignoreMethod() = aIn.mIgnoreMethod; aOut.ignoreVary() = aIn.mIgnoreVary; +} + +// static +void TypeUtils::ToCacheQueryParams(CacheQueryParams& aOut, + const MultiCacheQueryOptions& aIn) { + ToCacheQueryParams(aOut, static_cast<const CacheQueryOptions&>(aIn)); aOut.cacheNameSet() = aIn.mCacheName.WasPassed(); if (aOut.cacheNameSet()) { aOut.cacheName() = aIn.mCacheName.Value(); diff --git a/dom/cache/TypeUtils.h b/dom/cache/TypeUtils.h index ede919f55a5c0b331fdcc3494d81bd4004cfa0af..628a7f8bcd504d3fb54fcf408088c517f5c701bd 100644 --- a/dom/cache/TypeUtils.h +++ b/dom/cache/TypeUtils.h @@ -27,6 +27,7 @@ class AutoIPCStream; namespace dom { struct CacheQueryOptions; +struct MultiCacheQueryOptions; class InternalHeaders; class InternalRequest; class InternalResponse; @@ -88,6 +89,9 @@ class TypeUtils { void ToCacheQueryParams(CacheQueryParams& aOut, const CacheQueryOptions& aIn); + void ToCacheQueryParams(CacheQueryParams& aOut, + const MultiCacheQueryOptions& aIn); + already_AddRefed<Response> ToResponse(const CacheResponse& aIn); SafeRefPtr<InternalRequest> ToInternalRequest(const CacheRequest& aIn); diff --git a/dom/webidl/Cache.webidl b/dom/webidl/Cache.webidl index e1ca5fdc3bae2b9ca51babce24dd1db7bfdc1d58..92aaf2d79c9e80b61fe68dd6d88f128fd8fd7115 100644 --- a/dom/webidl/Cache.webidl +++ b/dom/webidl/Cache.webidl @@ -33,7 +33,6 @@ dictionary CacheQueryOptions { boolean ignoreSearch = false; boolean ignoreMethod = false; boolean ignoreVary = false; - DOMString cacheName; }; dictionary CacheBatchOperation { diff --git a/dom/webidl/CacheStorage.webidl b/dom/webidl/CacheStorage.webidl index ceced431f8bdd2f57aa841c5d896e840b27208bd..e1100bdfedd74db970047a249844560fa9afc2bd 100644 --- a/dom/webidl/CacheStorage.webidl +++ b/dom/webidl/CacheStorage.webidl @@ -19,7 +19,7 @@ interface CacheStorage { constructor(CacheStorageNamespace namespace, Principal principal); [NewObject] - Promise<Response> match(RequestInfo request, optional CacheQueryOptions options = {}); + Promise<Response> match(RequestInfo request, optional MultiCacheQueryOptions options = {}); [NewObject] Promise<boolean> has(DOMString cacheName); [NewObject] @@ -30,6 +30,10 @@ interface CacheStorage { Promise<sequence<DOMString>> keys(); }; +dictionary MultiCacheQueryOptions : CacheQueryOptions { + DOMString cacheName; +}; + // chrome-only, gecko specific extension enum CacheStorageNamespace { "content", "chrome" diff --git a/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-match.https.html.ini b/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-match.https.html.ini index 9e7414d3dd031c23cf427f6b861c711f4800a10e..3c80d41c5a7a5993565caa5e602b402b4e4399a6 100644 --- a/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-match.https.html.ini +++ b/testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-match.https.html.ini @@ -1,7 +1,4 @@ [cache-match.https.html] - [Cache.match does not support cacheName option] - expected: FAIL - [MIME type should be frozen at response construction.] expected: FAIL diff --git a/testing/web-platform/meta/service-workers/cache-storage/window/cache-match.https.html.ini b/testing/web-platform/meta/service-workers/cache-storage/window/cache-match.https.html.ini index 9e7414d3dd031c23cf427f6b861c711f4800a10e..3c80d41c5a7a5993565caa5e602b402b4e4399a6 100644 --- a/testing/web-platform/meta/service-workers/cache-storage/window/cache-match.https.html.ini +++ b/testing/web-platform/meta/service-workers/cache-storage/window/cache-match.https.html.ini @@ -1,7 +1,4 @@ [cache-match.https.html] - [Cache.match does not support cacheName option] - expected: FAIL - [MIME type should be frozen at response construction.] expected: FAIL diff --git a/testing/web-platform/meta/service-workers/cache-storage/worker/cache-match.https.html.ini b/testing/web-platform/meta/service-workers/cache-storage/worker/cache-match.https.html.ini index 9e7414d3dd031c23cf427f6b861c711f4800a10e..3c80d41c5a7a5993565caa5e602b402b4e4399a6 100644 --- a/testing/web-platform/meta/service-workers/cache-storage/worker/cache-match.https.html.ini +++ b/testing/web-platform/meta/service-workers/cache-storage/worker/cache-match.https.html.ini @@ -1,7 +1,4 @@ [cache-match.https.html] - [Cache.match does not support cacheName option] - expected: FAIL - [MIME type should be frozen at response construction.] expected: FAIL