|
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 |
|
7 // TODO Bug 957086 - The DataStoreImpl WebIDL will be removed once the |
|
8 // DataStore API is fully rewritten in C++ (i.e. should be |
|
9 // directly implemented by the DataStore WebIDL). |
|
10 |
|
11 [HeaderFile="mozilla/dom/DataStore.h", |
|
12 Func="mozilla::dom::DataStore::EnabledForScope", |
|
13 JSImplementation="@mozilla.org/dom/datastore-impl;1"] |
|
14 interface DataStoreImpl { |
|
15 void setEventTarget(EventTarget eventTarget); |
|
16 |
|
17 // Returns the label of the DataSource. |
|
18 readonly attribute DOMString name; |
|
19 |
|
20 // Returns the origin of the DataSource (e.g., 'facebook.com'). |
|
21 // This value is the manifest URL of the owner app. |
|
22 readonly attribute DOMString owner; |
|
23 |
|
24 // is readOnly a F(current_app, datastore) function? yes |
|
25 readonly attribute boolean readOnly; |
|
26 |
|
27 // Promise<any> |
|
28 Promise get(DataStoreKey... id); |
|
29 |
|
30 // Promise<void> |
|
31 Promise put(any obj, DataStoreKey id, optional DOMString revisionId = ""); |
|
32 |
|
33 // Promise<DataStoreKey> |
|
34 Promise add(any obj, optional DataStoreKey id, |
|
35 optional DOMString revisionId = ""); |
|
36 |
|
37 // Promise<boolean> |
|
38 Promise remove(DataStoreKey id, optional DOMString revisionId = ""); |
|
39 |
|
40 // Promise<void> |
|
41 Promise clear(optional DOMString revisionId = ""); |
|
42 |
|
43 readonly attribute DOMString revisionId; |
|
44 |
|
45 // Promise<unsigned long> |
|
46 Promise getLength(); |
|
47 |
|
48 [NewObject] |
|
49 DataStoreCursor sync(optional DOMString revisionId = ""); |
|
50 }; |
|
51 |
|
52 |
|
53 // TODO Bug 957086 - The DataStoreCursorImpl WebIDL will be removed once the |
|
54 // DataStore API is fully rewritten in C++ (i.e. should be |
|
55 // directly implemented by the DataStoreCursor WebIDL). |
|
56 |
|
57 [HeaderFile="mozilla/dom/DataStore.h", |
|
58 Func="mozilla::dom::DataStore::EnabledForScope", |
|
59 JSImplementation="@mozilla.org/dom/datastore-cursor-impl;1"] |
|
60 interface DataStoreCursorImpl { |
|
61 // the DataStore |
|
62 readonly attribute DataStore store; |
|
63 |
|
64 // Promise<DataStoreTask> |
|
65 Promise next(); |
|
66 |
|
67 void close(); |
|
68 }; |