Bumping manifests a=b2g-bump
[gecko.git] / dom / webidl / DataStore.webidl
blob25abbe038007a371b4842ec855831819f3346078
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  */
7 typedef (DOMString or unsigned long) DataStoreKey;
9 // TODO Bug 957086 - The constructor and the setDataStoreImpl(...) will be
10 //                   removed once the DataStore API is fully rewritten in C++,
11 //                   which currently plays a role of C++ proxy directing to the
12 //                   JS codes implemented by the DataStoreImpl WebIDL.
14 [Func="Navigator::HasDataStoreSupport",
15  ChromeConstructor,
16  Exposed=(Window,Worker)]
17 interface DataStore : EventTarget {
18   // Returns the label of the DataSource.
19   [GetterThrows]
20   readonly attribute DOMString name;
22   // Returns the origin of the DataSource (e.g., 'facebook.com').
23   // This value is the manifest URL of the owner app.
24   [GetterThrows]
25   readonly attribute DOMString owner;
27   // is readOnly a F(current_app, datastore) function? yes
28   [GetterThrows]
29   readonly attribute boolean readOnly;
31   [Throws]
32   Promise<any> get(DataStoreKey... id);
34   [Throws]
35   Promise<void> put(any obj, DataStoreKey id, optional DOMString revisionId = "");
37   [Throws]
38   Promise<DataStoreKey> add(any obj, optional DataStoreKey id,
39                             optional DOMString revisionId = "");
41   [Throws]
42   Promise<boolean> remove(DataStoreKey id, optional DOMString revisionId = "");
44   [Throws]
45   Promise<void> clear(optional DOMString revisionId = "");
47   [GetterThrows]
48   readonly attribute DOMString revisionId;
50   attribute EventHandler onchange;
52   [Throws]
53   Promise<unsigned long> getLength();
55   [NewObject, Throws]
56   DataStoreCursor sync(optional DOMString revisionId = "");
59 partial interface DataStore {
60   [ChromeOnly, Throws]
61   void setDataStoreImpl(DataStoreImpl store);
64 // TODO Bug 957086 - The constructor and the setDataStoreCursorImpl(...) will be
65 //                   removed once the DataStore API is fully rewritten in C++,
66 //                   which currently plays a role of C++ proxy directing to the
67 //                   JS codes implemented by the DataStoreCursorImpl WebIDL.
69 [Func="Navigator::HasDataStoreSupport",
70  ChromeConstructor,
71  Exposed=(Window,Worker)]
72 interface DataStoreCursor {
73   // the DataStore
74   [GetterThrows]
75   readonly attribute DataStore store;
77   [Throws]
78   Promise<DataStoreTask> next();
80   [Throws]
81   void close();
84 partial interface DataStoreCursor {
85   [ChromeOnly]
86   void setDataStoreCursorImpl(DataStoreCursorImpl cursor);
89 enum DataStoreOperation {
90   "add",
91   "update",
92   "remove",
93   "clear",
94   "done"
97 dictionary DataStoreTask {
98   DOMString revisionId;
100   DataStoreOperation operation;
102   // When |operation| is "clear" or "done", this must return null.
103   DataStoreKey? id;
104   any data;
107 // For internal use.
108 dictionary DataStoreRevisionData {
109   DOMString revisionId = "";
110   unsigned long objectId = 0;
111   DOMString operation = "";