1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * The origin of this IDL file is
7 * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
8 *
9 */
10
11// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-storage
12
13// invalid widl
14// interface Principal;
15
16[Exposed=(Window,Worker),
17 ChromeConstructor(CacheStorageNamespace namespace, Principal principal),
18 Func="mozilla::dom::DOMPrefs::DOMCachesEnabled"]
19interface CacheStorage {
20  [NewObject]
21  Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);
22  [NewObject]
23  Promise<boolean> has(DOMString cacheName);
24  [NewObject]
25  Promise<Cache> open(DOMString cacheName);
26  [NewObject]
27  Promise<boolean> delete(DOMString cacheName);
28  [NewObject]
29  Promise<sequence<DOMString>> keys();
30};
31
32// chrome-only, gecko specific extension
33enum CacheStorageNamespace {
34  "content", "chrome"
35};
36