dom/webidl/DataStore.webidl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 interface DataStore : EventTarget {
    17   // Returns the label of the DataSource.
    18   [GetterThrows]
    19   readonly attribute DOMString name;
    21   // Returns the origin of the DataSource (e.g., 'facebook.com').
    22   // This value is the manifest URL of the owner app.
    23   [GetterThrows]
    24   readonly attribute DOMString owner;
    26   // is readOnly a F(current_app, datastore) function? yes
    27   [GetterThrows]
    28   readonly attribute boolean readOnly;
    30   // Promise<any>
    31   [Throws]
    32   Promise get(DataStoreKey... id);
    34   // Promise<void>
    35   [Throws]
    36   Promise put(any obj, DataStoreKey id, optional DOMString revisionId = "");
    38   // Promise<DataStoreKey>
    39   [Throws]
    40   Promise add(any obj, optional DataStoreKey id,
    41               optional DOMString revisionId = "");
    43   // Promise<boolean>
    44   [Throws]
    45   Promise remove(DataStoreKey id, optional DOMString revisionId = "");
    47   // Promise<void>
    48   [Throws]
    49   Promise clear(optional DOMString revisionId = "");
    51   [GetterThrows]
    52   readonly attribute DOMString revisionId;
    54   attribute EventHandler onchange;
    56   // Promise<unsigned long>
    57   [Throws]
    58   Promise getLength();
    60   [NewObject, Throws]
    61   DataStoreCursor sync(optional DOMString revisionId = "");
    62 };
    64 partial interface DataStore {
    65   [ChromeOnly, Throws]
    66   void setDataStoreImpl(DataStoreImpl store);
    67 };
    69 // TODO Bug 957086 - The constructor and the setDataStoreCursorImpl(...) will be
    70 //                   removed once the DataStore API is fully rewritten in C++,
    71 //                   which currently plays a role of C++ proxy directing to the
    72 //                   JS codes implemented by the DataStoreCursorImpl WebIDL.
    74 [Pref="dom.datastore.enabled",
    75  ChromeConstructor]
    76 interface DataStoreCursor {
    77   // the DataStore
    78   [GetterThrows]
    79   readonly attribute DataStore store;
    81   // Promise<DataStoreTask>
    82   [Throws]
    83   Promise next();
    85   [Throws]
    86   void close();
    87 };
    89 partial interface DataStoreCursor {
    90   [ChromeOnly]
    91   void setDataStoreCursorImpl(DataStoreCursorImpl cursor);
    92 };
    94 enum DataStoreOperation {
    95   "add",
    96   "update",
    97   "remove",
    98   "clear",
    99   "done"
   100 };
   102 dictionary DataStoreTask {
   103   DOMString revisionId;
   105   DataStoreOperation operation;
   106   DataStoreKey id;
   107   any data;
   108 };

mercurial