Bug 1654531 - Remove the support for cache option from cache.match; r=dom-workers-and-storage-reviewers,webidl,asuth,baku

Fix the test cases for "Cache.match does not support cacheName option"

Depends on D84502

Differential Revision: https://phabricator.services.mozilla.com/D84503
This commit is contained in:
Tom Tung 2020-09-17 13:02:46 +00:00
parent 6f2d33d798
commit fc951d200a
9 changed files with 22 additions and 17 deletions

View File

@ -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()) {

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -33,7 +33,6 @@ dictionary CacheQueryOptions {
boolean ignoreSearch = false;
boolean ignoreMethod = false;
boolean ignoreVary = false;
DOMString cacheName;
};
dictionary CacheBatchOperation {

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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