3 <title>IndexedDB IDL tests</title>
4 <script src=../../../resources/testharness.js></script>
5 <script src=../../../resources/testharnessreport.js></script>
6 <script src=/resources/WebIDLParser.js></script>
7 <script src=/resources/idlharness.js></script>
8 <script src=support.js></script>
10 <h1>IndexedDB IDL tests</h1>
13 <script type=text/plain>
14 enum IDBTransactionMode {
20 enum IDBRequestReadyState {
25 interface IDBKeyRange {
26 readonly attribute any lower;
27 readonly attribute any upper;
28 readonly attribute boolean lowerOpen;
29 readonly attribute boolean upperOpen;
30 static IDBKeyRange only (any value);
31 static IDBKeyRange lowerBound (any lower, optional boolean open = false);
32 static IDBKeyRange upperBound (any upper, optional boolean open = false);
33 static IDBKeyRange bound (any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
36 enum IDBCursorDirection {
43 dictionary IDBObjectStoreParameters {
44 (DOMString or sequence<DOMString>)? keyPath = null;
45 boolean autoIncrement = false;
48 dictionary IDBIndexParameters {
49 boolean unique = false;
50 boolean multiEntry = false;
53 dictionary IDBVersionChangeEventInit : EventInit {
54 unsigned long long oldVersion = 0;
55 unsigned long long? newVersion = null;
58 interface IDBRequest : EventTarget {
59 readonly attribute any result;
60 readonly attribute DOMError error;
61 readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source;
62 readonly attribute IDBTransaction transaction;
63 readonly attribute IDBRequestReadyState readyState;
64 attribute EventHandler onsuccess;
65 attribute EventHandler onerror;
68 interface IDBOpenDBRequest : IDBRequest {
69 attribute EventHandler onblocked;
70 attribute EventHandler onupgradeneeded;
73 [Constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict)]
74 interface IDBVersionChangeEvent : Event {
75 readonly attribute unsigned long long oldVersion;
76 readonly attribute unsigned long long? newVersion;
79 Window implements IDBEnvironment;
80 WorkerUtils implements IDBEnvironment;
83 interface IDBEnvironment {
84 readonly attribute IDBFactory indexedDB;
87 interface IDBFactory {
88 IDBOpenDBRequest open (DOMString name, [EnforceRange] optional unsigned long long version);
89 IDBOpenDBRequest deleteDatabase (DOMString name);
90 short cmp (any first, any second);
93 interface IDBDatabase : EventTarget {
94 readonly attribute DOMString name;
95 readonly attribute unsigned long long version;
96 readonly attribute DOMStringList objectStoreNames;
97 IDBObjectStore createObjectStore (DOMString name, optional IDBObjectStoreParameters optionalParameters);
98 void deleteObjectStore (DOMString name);
99 IDBTransaction transaction ((DOMString or sequence<DOMString>) storeNames, optional IDBTransactionMode mode = "readonly");
101 attribute EventHandler onabort;
102 attribute EventHandler onerror;
103 attribute EventHandler onversionchange;
106 interface IDBObjectStore {
107 readonly attribute DOMString name;
108 readonly attribute any keyPath;
109 readonly attribute DOMStringList indexNames;
110 readonly attribute IDBTransaction transaction;
111 readonly attribute boolean autoIncrement;
112 IDBRequest put (any value, optional any key);
113 IDBRequest add (any value, optional any key);
114 IDBRequest delete (any key);
115 IDBRequest get (any key);
117 IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
118 IDBIndex createIndex (DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters optionalParameters);
119 IDBIndex index (DOMString name);
120 void deleteIndex (DOMString indexName);
121 IDBRequest count (optional any key);
125 readonly attribute DOMString name;
126 readonly attribute IDBObjectStore objectStore;
127 readonly attribute any keyPath;
128 readonly attribute boolean multiEntry;
129 readonly attribute boolean unique;
130 IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
131 IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next");
132 IDBRequest get (any key);
133 IDBRequest getKey (any key);
134 IDBRequest count (optional any key);
137 interface IDBCursor {
138 readonly attribute (IDBObjectStore or IDBIndex) source;
139 readonly attribute IDBCursorDirection direction;
140 readonly attribute any key;
141 readonly attribute any primaryKey;
142 IDBRequest update (any value);
143 void advance ([EnforceRange] unsigned long count);
144 void continue (optional any key);
145 IDBRequest delete ();
148 interface IDBCursorWithValue : IDBCursor {
149 readonly attribute any value;
152 interface IDBTransaction : EventTarget {
153 readonly attribute IDBTransactionMode mode;
154 readonly attribute IDBDatabase db;
155 readonly attribute DOMError error;
156 IDBObjectStore objectStore (DOMString name);
158 attribute EventHandler onabort;
159 attribute EventHandler oncomplete;
160 attribute EventHandler onerror;
164 <script type="text/plain" class="untested">
165 interface Window { };
167 interface WorkerUtils { };
169 interface EventTarget { };
175 var idlArray = new IdlArray();
177 [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
178 if (node.className == "untested") {
179 idlArray.add_untested_idls(node.textContent);
181 idlArray.add_idls(node.textContent);
185 idlArray.add_objects({
188 IDBOpenDBRequest: [],
190 IDBVersionChangeEvent: ['new IDBVersionChangeEvent("foo")'],
191 IDBFactory: ['window.indexedDB'],
196 IDBCursorWithValue: [],