blob: 55c091b7e995a6182293790839905ceff77ad6e1 [file] [log] [blame]
Test IndexedDB's createObjectStore's various options
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "create-object-store-options.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
db.createObjectStore('a', {keyPath: 'a'})
db.createObjectStore('b')
db.createObjectStore('c', {autoIncrement: true});
trans = db.transaction(['a', 'b'], 'readwrite')
PASS trans.mode is "readwrite"
trans.objectStore('a').put({'a': 0})
Expecting TypeError exception from db.createObjectStore('d', 'bar');
PASS Exception was thrown.
PASS db.createObjectStore('d', 'bar'); threw TypeError: Failed to execute 'createObjectStore' on 'IDBDatabase': parameter 2 ('options') is not an object.
Expecting TypeError exception from db.createObjectStore('e', false);
PASS Exception was thrown.
PASS db.createObjectStore('e', false); threw TypeError: Failed to execute 'createObjectStore' on 'IDBDatabase': parameter 2 ('options') is not an object.
trans.objectStore('b').put({'a': 0}, 0)
trans.objectStore('a').get(0)
PASS event.target.result.a is {a: 0}
trans.objectStore('b').get(0)
PASS event.target.result.a is {a: 0}
PASS successfullyParsed is true
TEST COMPLETE