Commit 55d949a1 authored by jsbell@chromium.org's avatar jsbell@chromium.org

Service Worker: Include promise types in IDL

The Chromium IDL parser was updated to support Promise<T> syntax.
Update the IDLs to include types from the spec. Note that the type
isn't actually used for anything so this is a no-op change, for
documentation only.

Review URL: https://codereview.chromium.org/723643002

git-svn-id: svn://svn.chromium.org/blink/trunk@185381 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4eb877c5
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
// http://fetch.spec.whatwg.org/#body
typedef object JSON;
[
RuntimeEnabled=ServiceWorker,
Exposed=ServiceWorker,
......@@ -12,11 +13,11 @@
TypeChecking=Interface,
] interface Body {
readonly attribute boolean bodyUsed;
[CallWith=ScriptState] Promise arrayBuffer();
[CallWith=ScriptState] Promise blob();
[CallWith=ScriptState] Promise json();
[CallWith=ScriptState] Promise text();
[CallWith=ScriptState] Promise<ArrayBuffer> arrayBuffer();
[CallWith=ScriptState] Promise<Blob> blob();
[CallWith=ScriptState] Promise<JSON> json();
[CallWith=ScriptState] Promise<USVString> text();
// Still to be implemented.
// [CallWith=ScriptState] Promise formData();
// [CallWith=ScriptState] Promise<FormData> formData();
};
......@@ -12,21 +12,19 @@ typedef (Request or USVString) RequestInfo;
RuntimeEnabled=ServiceWorkerCache,
TypeChecking=Interface,
] interface Cache {
[CallWith=ScriptState, RaisesException] Promise match(RequestInfo request, optional CacheQueryOptions options);
[CallWith=ScriptState, RaisesException] Promise<Response> match(RequestInfo 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, RaisesException] Promise matchAll(RequestInfo request, optional CacheQueryOptions options);
// [CallWith=ScriptState, RaisesException] Promise<sequence<Response>> matchAll(RequestInfo request, optional CacheQueryOptions options);
// FIXME: Implement add(): http://crbug.com/427652
// [CallWith=ScriptState, RaisesException] Promise add(RequestInfo request);
// [CallWith=ScriptState, RaisesException] Promise<void> add(RequestInfo request);
// FIXME: Implement addAll(): http://crbug.com/427652
// FIXME: Sequences of Unions are not yet supported, instead bind a generic type. http://crbug.com/240176
// [CallWith=ScriptState] Promise addAll(sequence<RequestInfo> requests);
// [CallWith=ScriptState] Promise addAll(sequence<any> requests);
// [CallWith=ScriptState] Promise<void> addAll(sequence<RequestInfo> requests);
[CallWith=ScriptState, RaisesException] Promise put(RequestInfo request, Response response);
[CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] Promise delete(RequestInfo request, optional CacheQueryOptions options);
[CallWith=ScriptState, RaisesException] Promise keys(optional RequestInfo request, optional CacheQueryOptions options);
[CallWith=ScriptState, RaisesException] Promise<void> put(RequestInfo request, Response response);
[CallWith=ScriptState, ImplementedAs=deleteFunction, RaisesException] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options);
[CallWith=ScriptState, RaisesException] Promise<sequence<Response>> keys(optional RequestInfo request, optional CacheQueryOptions options);
};
......@@ -9,10 +9,10 @@
RuntimeEnabled=ServiceWorkerCache,
TypeChecking=Interface,
] interface CacheStorage {
[CallWith=ScriptState] Promise has(USVString cacheName);
[CallWith=ScriptState] Promise open(USVString cacheName);
[CallWith=ScriptState, ImplementedAs=deleteFunction] Promise delete(USVString cacheName);
[CallWith=ScriptState] Promise keys();
[CallWith=ScriptState] Promise<boolean> has(USVString cacheName);
[CallWith=ScriptState] Promise<Cache> open(USVString cacheName);
[CallWith=ScriptState, ImplementedAs=deleteFunction] Promise<boolean> delete(USVString cacheName);
[CallWith=ScriptState] Promise<sequence<DOMString>> keys();
// FIXME: From https://github.com/slightlyoff/ServiceWorker/issues/372 and the updated
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache-storage ,
// we have yet to implement match().
......
......@@ -9,5 +9,5 @@
GarbageCollected,
TypeChecking=Interface,
] interface ServiceWorkerClients {
[CallWith=ScriptState] Promise getAll(optional ServiceWorkerClientQueryOptions options);
[CallWith=ScriptState] Promise<sequence<ServiceWorkerClient>?> getAll(optional ServiceWorkerClientQueryOptions options);
};
......@@ -35,8 +35,9 @@
TypeChecking=Interface,
] interface ServiceWorkerContainer {
[Unforgeable] readonly attribute ServiceWorker? controller;
[CallWith=ScriptState] readonly attribute Promise ready;
[CallWith=ScriptState] readonly attribute Promise<ServiceWorkerRegistration> ready;
[CallWith=ScriptState, ImplementedAs=registerServiceWorker] Promise register(USVString url, optional RegistrationOptions options);
[CallWith=ScriptState] Promise getRegistration(optional USVString documentURL = "");
[CallWith=ScriptState, ImplementedAs=registerServiceWorker] Promise<ServiceWorkerRegistration> register(USVString url, optional RegistrationOptions options);
[CallWith=ScriptState] Promise<ServiceWorkerRegistration> getRegistration(optional USVString documentURL = "");
};
......@@ -40,8 +40,8 @@
[CallWith=ExecutionContext, Unforgeable] readonly attribute USVString scope;
[CallWith=ExecutionContext, Unforgeable, RuntimeEnabled=ServiceWorkerCache] readonly attribute CacheStorage caches;
[CallWith=ScriptState] Promise fetch(DOMString request, optional Dictionary requestInitDict);
[CallWith=ScriptState] Promise fetch(Request request, optional Dictionary requestInitDict);
[CallWith=ScriptState] Promise<Response> fetch(DOMString request, optional Dictionary requestInitDict);
[CallWith=ScriptState] Promise<Response> fetch(Request request, optional Dictionary requestInitDict);
[RaisesException] void close();
......
......@@ -12,9 +12,10 @@
[Unforgeable] readonly attribute ServiceWorker? installing;
[Unforgeable] readonly attribute ServiceWorker? waiting;
[Unforgeable] readonly attribute ServiceWorker? active;
readonly attribute USVString scope;
[CallWith=ScriptState] Promise unregister();
[CallWith=ScriptState] Promise<boolean> unregister();
attribute EventHandler onupdatefound;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment