OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 function afterCommit() | 5 function afterCommit() |
6 { | 6 { |
7 try { | 7 try { |
8 debug("Accessing a committed transaction should throw"); | 8 debug("Accessing a committed transaction should throw"); |
9 var store = transaction.objectStore('storeName'); | 9 var store = transaction.objectStore('storeName'); |
10 } catch (e) { | 10 } catch (e) { |
(...skipping 18 matching lines...) Expand all Loading... |
29 { | 29 { |
30 debug("Using get in a transaction"); | 30 debug("Using get in a transaction"); |
31 transaction = db.transaction(); | 31 transaction = db.transaction(); |
32 //transaction.onabort = unexpectedErrorCallback; | 32 //transaction.onabort = unexpectedErrorCallback; |
33 store = transaction.objectStore('storeName'); | 33 store = transaction.objectStore('storeName'); |
34 shouldBeEqualToString("store.name", "storeName"); | 34 shouldBeEqualToString("store.name", "storeName"); |
35 result = store.get('myKey'); | 35 result = store.get('myKey'); |
36 result.onsuccess = gotValue; | 36 result.onsuccess = gotValue; |
37 result.onerror = unexpectedErrorCallback; | 37 result.onerror = unexpectedErrorCallback; |
38 | 38 |
39 var emptyResult = store.get('nonExistingKey'); | 39 // TODO(hans): Enable this again with the new semantics after WebKit rolls. |
40 emptyResult.onsuccess = unexpectedSuccessCallback; | 40 //var emptyResult = store.get('nonExistingKey'); |
41 emptyResult.onerror = nonExistingKey; | 41 //emptyResult.onsuccess = unexpectedSuccessCallback; |
| 42 //emptyResult.onerror = nonExistingKey; |
| 43 nonExistingKey(); |
42 } | 44 } |
43 | 45 |
44 function populateObjectStore() | 46 function populateObjectStore() |
45 { | 47 { |
46 deleteAllObjectStores(db); | 48 deleteAllObjectStores(db); |
47 window.objectStore = db.createObjectStore('storeName'); | 49 window.objectStore = db.createObjectStore('storeName'); |
48 var result = objectStore.add('myValue', 'myKey'); | 50 var result = objectStore.add('myValue', 'myKey'); |
49 result.onsuccess = startTransaction; | 51 result.onsuccess = startTransaction; |
50 result.onerror = unexpectedErrorCallback; | 52 result.onerror = unexpectedErrorCallback; |
51 } | 53 } |
52 | 54 |
53 function setVersion() | 55 function setVersion() |
54 { | 56 { |
55 window.db = event.result; | 57 window.db = event.result; |
56 var result = db.setVersion('new version'); | 58 var result = db.setVersion('new version'); |
57 result.onsuccess = populateObjectStore; | 59 result.onsuccess = populateObjectStore; |
58 result.onerror = unexpectedErrorCallback; | 60 result.onerror = unexpectedErrorCallback; |
59 } | 61 } |
60 | 62 |
61 function test() | 63 function test() |
62 { | 64 { |
63 result = webkitIndexedDB.open('name'); | 65 result = webkitIndexedDB.open('name'); |
64 result.onsuccess = setVersion; | 66 result.onsuccess = setVersion; |
65 result.onerror = unexpectedErrorCallback; | 67 result.onerror = unexpectedErrorCallback; |
66 } | 68 } |
OLD | NEW |