blob: e2874d604ce428088327dd4a5314f8818f41b225 [file] [log] [blame]
Test IndexedDB's clearing an object store
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
objectStore = db.createObjectStore('foo', { autoIncrement: true });
request = objectStore.add({});
Expecting exception from db.transaction('foo').objectStore('foo').clear();
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'clear' on 'IDBObjectStore': The transaction is read-only.
db.transaction('foo', 'readwrite')
transaction.objectStore('foo').clear();
request = db.transaction('foo').objectStore('foo').openCursor();
cursor = request.result;
PASS cursor is null
PASS successfullyParsed is true
TEST COMPLETE