Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | */ |
michael@0 | 6 | |
michael@0 | 7 | // TODO Bug 957086 - The DataStoreImpl WebIDL will be removed once the |
michael@0 | 8 | // DataStore API is fully rewritten in C++ (i.e. should be |
michael@0 | 9 | // directly implemented by the DataStore WebIDL). |
michael@0 | 10 | |
michael@0 | 11 | [HeaderFile="mozilla/dom/DataStore.h", |
michael@0 | 12 | Func="mozilla::dom::DataStore::EnabledForScope", |
michael@0 | 13 | JSImplementation="@mozilla.org/dom/datastore-impl;1"] |
michael@0 | 14 | interface DataStoreImpl { |
michael@0 | 15 | void setEventTarget(EventTarget eventTarget); |
michael@0 | 16 | |
michael@0 | 17 | // Returns the label of the DataSource. |
michael@0 | 18 | readonly attribute DOMString name; |
michael@0 | 19 | |
michael@0 | 20 | // Returns the origin of the DataSource (e.g., 'facebook.com'). |
michael@0 | 21 | // This value is the manifest URL of the owner app. |
michael@0 | 22 | readonly attribute DOMString owner; |
michael@0 | 23 | |
michael@0 | 24 | // is readOnly a F(current_app, datastore) function? yes |
michael@0 | 25 | readonly attribute boolean readOnly; |
michael@0 | 26 | |
michael@0 | 27 | // Promise<any> |
michael@0 | 28 | Promise get(DataStoreKey... id); |
michael@0 | 29 | |
michael@0 | 30 | // Promise<void> |
michael@0 | 31 | Promise put(any obj, DataStoreKey id, optional DOMString revisionId = ""); |
michael@0 | 32 | |
michael@0 | 33 | // Promise<DataStoreKey> |
michael@0 | 34 | Promise add(any obj, optional DataStoreKey id, |
michael@0 | 35 | optional DOMString revisionId = ""); |
michael@0 | 36 | |
michael@0 | 37 | // Promise<boolean> |
michael@0 | 38 | Promise remove(DataStoreKey id, optional DOMString revisionId = ""); |
michael@0 | 39 | |
michael@0 | 40 | // Promise<void> |
michael@0 | 41 | Promise clear(optional DOMString revisionId = ""); |
michael@0 | 42 | |
michael@0 | 43 | readonly attribute DOMString revisionId; |
michael@0 | 44 | |
michael@0 | 45 | // Promise<unsigned long> |
michael@0 | 46 | Promise getLength(); |
michael@0 | 47 | |
michael@0 | 48 | [NewObject] |
michael@0 | 49 | DataStoreCursor sync(optional DOMString revisionId = ""); |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | |
michael@0 | 53 | // TODO Bug 957086 - The DataStoreCursorImpl WebIDL will be removed once the |
michael@0 | 54 | // DataStore API is fully rewritten in C++ (i.e. should be |
michael@0 | 55 | // directly implemented by the DataStoreCursor WebIDL). |
michael@0 | 56 | |
michael@0 | 57 | [HeaderFile="mozilla/dom/DataStore.h", |
michael@0 | 58 | Func="mozilla::dom::DataStore::EnabledForScope", |
michael@0 | 59 | JSImplementation="@mozilla.org/dom/datastore-cursor-impl;1"] |
michael@0 | 60 | interface DataStoreCursorImpl { |
michael@0 | 61 | // the DataStore |
michael@0 | 62 | readonly attribute DataStore store; |
michael@0 | 63 | |
michael@0 | 64 | // Promise<DataStoreTask> |
michael@0 | 65 | Promise next(); |
michael@0 | 66 | |
michael@0 | 67 | void close(); |
michael@0 | 68 | }; |