4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 <script src="resources/shared.js"></script>
8 <p id="description"></p>
9 <div id="console"></div>
12 description("Test IndexedDB object store required arguments");
13 if (window.layoutTestController)
14 layoutTestController.waitUntilDone();
18 indexedDB = evalAndLog("indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;");
19 shouldBeFalse("indexedDB == null");
20 IDBDatabaseException = evalAndLog("IDBDatabaseException = window.IDBDatabaseException || window.webkitIDBDatabaseException;");
21 shouldBeFalse("IDBDatabaseException == null");
22 IDBCursor = evalAndLog("IDBCursor = window.IDBCursor || window.webkitIDBCursor;");
23 shouldBeFalse("IDBCursor == null");
24 IDBKeyRange = evalAndLog("IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;");
25 shouldBeFalse("IDBKeyRange == null");
27 name = window.location.pathname;
28 description = "My Test Database";
29 request = evalAndLog("indexedDB.open(name, description)");
30 request.onsuccess = openSuccess;
31 request.onerror = unexpectedErrorCallback;
34 function openSuccess()
36 db = evalAndLog("db = event.target.result");
38 request = evalAndLog("request = db.setVersion('1')");
39 request.onsuccess = createAndPopulateObjectStore;
40 request.onerror = unexpectedErrorCallback;
43 function createAndPopulateObjectStore()
45 deleteAllObjectStores(db);
47 objectStore = evalAndLog("objectStore = db.createObjectStore('foo');");
48 shouldThrow("objectStore.put();");
49 shouldThrow("objectStore.add();");
50 shouldThrow("objectStore.delete();");
51 shouldThrow("objectStore.get();");
52 shouldThrow("objectStore.createIndex();");
53 shouldThrow("objectStore.createIndex('foo');");
54 shouldThrow("objectStore.index();");
55 shouldThrow("objectStore.deleteIndex();");