1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 debug("Accessing a committed transaction should throw");
9 var store
= transaction
.objectStore('storeName');
12 shouldBe('exc.code', 'DOMException.INVALID_STATE_ERR');
17 function nonExistingKey()
19 shouldBe("event.target.result", "undefined");
20 transaction
.oncomplete
= afterCommit
;
25 value
= event
.target
.result
;
26 shouldBeEqualToString('value', 'myValue');
29 function startTransaction()
31 debug("Using get in a transaction");
32 transaction
= db
.transaction('storeName');
33 //transaction.onabort = unexpectedErrorCallback;
34 store
= transaction
.objectStore('storeName');
35 shouldBeEqualToString("store.name", "storeName");
36 request
= store
.get('myKey');
37 request
.onsuccess
= gotValue
;
38 request
.onerror
= unexpectedErrorCallback
;
40 var emptyRequest
= store
.get('nonExistingKey');
41 emptyRequest
.onsuccess
= nonExistingKey
;
42 emptyRequest
.onerror
= unexpectedErrorCallback
;
45 function populateObjectStore()
47 db
= event
.target
.result
;
48 deleteAllObjectStores(db
);
49 window
.objectStore
= db
.createObjectStore('storeName');
50 var request
= objectStore
.add('myValue', 'myKey');
51 request
.onerror
= unexpectedErrorCallback
;
55 indexedDBTest(populateObjectStore
, startTransaction
);