blob: 739d2665ad9e0c256008aecec0e2646942ae63cf [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// See https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache
[
GarbageCollected,
Exposed=ServiceWorker,
RuntimeEnabled=ServiceWorkerCache,
TypeChecking=Interface,
] interface Cache {
// FIXME: Blink doesn't support union types, we use overrides instead. See http://crbug.com/240176
// [CallWith=ScriptState] Promise match((Request or USVString) request, optional CacheQueryOptions options);
[CallWith=ScriptState] Promise match(Request request, optional CacheQueryOptions options);
[CallWith=ScriptState, RaisesException] Promise match(USVString request, optional CacheQueryOptions options);
// FIXME: Implement matchAll(): http://crbug.com/428363
// FIXME: First argument of matchAll() should be optional: http://crbug.com/425459
// [CallWith=ScriptState] Promise matchAll((Request or USVString) request, optional CacheQueryOptions options);
// [CallWith=ScriptState] Promise matchAll(Request request, optional CacheQueryOptions options);
// [CallWith=ScriptState, RaisesException] Promise matchAll(USVString request, optional CacheQueryOptions options);
// FIXME: Implement add(): http://crbug.com/427652
// [CallWith=ScriptState] Promise add((Request or USVString) request);
// [CallWith=ScriptState] Promise add(Request request);
// [CallWith=ScriptState, RaisesException] Promise add(USVString request);
// FIXME: Implement addAll(): http://crbug.com/427652
// FIXME: The lack of union type support together with the sequence mean we can't use overrides here, instead
// bind a generic type.
// [CallWith=ScriptState] Promise addAll(sequence<Request or USVString> requests);
// [CallWith=ScriptState] Promise addAll(sequence<any> requests);
// [CallWith=ScriptState] Promise put((Request or USVString) request, Response response);
[CallWith=ScriptState] Promise put(Request request, Response response);
[CallWith=ScriptState, RaisesException] Promise put(USVString request, Response response);
// [CallWith=ScriptState] Promise delete((Request or USVString) request, optional CacheQueryOptions options);
[CallWith=ScriptState, ImplementedAs=deleteFunction] Promise delete(Request request, optional CacheQueryOptions options);
[CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] Promise delete(USVString request, optional CacheQueryOptions options);
// [CallWith=ScriptState] Promise keys(optional (Request or USVString) request, optional CacheQueryOptions options);
[CallWith=ScriptState] Promise keys(optional Request request, optional CacheQueryOptions options);
[CallWith=ScriptState, RaisesException] Promise keys(USVString request, optional CacheQueryOptions options);
};