[ServiceWorker] add [NewObject] where appropriate (#692)

There are a lot of methods in the spec that always return a new object.  For example, all the Cache and CacheStorage methods require returning a new Promise object.  It would be nice to flag these as [NewObject] to make the IDL more self-documenting.

For Cache:

```
[Exposed=(Window,Worker)]
interface CacheStorage {
  [NewObject] Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);
  [NewObject] Promise<boolean> has(DOMString cacheName);
  [NewObject] Promise<Cache> open(DOMString cacheName);
  [NewObject] Promise<boolean> delete(DOMString cacheName);
  [NewObject] Promise<sequence<DOMString>> keys();
};
```

and

```
[Exposed=(Window,Worker)]
interface Cache {
  [New Object] Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);
  [New Object] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options);
  [New Object] Promise<void> add(RequestInfo request);
  [New Object] Promise<void> addAll(sequence<RequestInfo> requests);
  [New Object] Promise<void> put(RequestInfo request, Response response);
  [New Object] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options);
  [New Object] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options);
};
```

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/692

Received on Monday, 4 May 2015 19:12:29 UTC