Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: chrome/test/data/indexeddb/transaction_test.js

Issue 6209005: Fix IndexedDB race condition during shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing Jeremy's comments Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/indexeddb/transaction_run_forever.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 finalTransactionCompleted() 5 function finalTransactionCompleted()
6 { 6 {
7 debug('The final transaction completed.'); 7 debug('The final transaction completed.');
8 done(); 8 done();
9 } 9 }
10 10
11 function finalTransactionAborted() 11 function finalTransactionAborted()
12 { 12 {
13 fail('The final transaction should not abort.'); 13 fail('The final transaction should not abort.');
14 } 14 }
15 15
16 function emplyeeNotFound() 16 function employeeNotFound()
17 { 17 {
18 debug('Employee not found.'); 18 debug('Employee not found.');
19 shouldBe("event.result", "undefined");
19 } 20 }
20 21
21 function newTransactionAborted() 22 function newTransactionAborted()
22 { 23 {
23 debug('The transaction was aborted.'); 24 debug('The transaction was aborted.');
24 25
25 var finalTransaction = db.transaction([], IDBTransaction.READ_ONLY, 0); 26 var finalTransaction = db.transaction({objectStoreNames: [], mode: IDBTransact ion.READ_ONLY});
26 finalTransaction.oncomplete = finalTransactionCompleted; 27 finalTransaction.oncomplete = finalTransactionCompleted;
27 finalTransaction.onabort = finalTransactionAborted; 28 finalTransaction.onabort = finalTransactionAborted;
28 29
29 var request = finalTransaction.objectStore('employees').get(0); 30 var request = finalTransaction.objectStore('employees').get(0);
30 request.onsuccess = unexpectedSuccessCallback; 31 request.onsuccess = employeeNotFound;
31 request.onerror = emplyeeNotFound; 32 request.onerror = unexpectedErrorCallback;
32 } 33 }
33 34
34 function newTransactionCompleted() 35 function newTransactionCompleted()
35 { 36 {
36 fail('The new transaction should not complete.'); 37 fail('The new transaction should not complete.');
37 } 38 }
38 39
39 function employeeAdded() 40 function employeeAdded()
40 { 41 {
41 debug('Added an employee inside the transaction.'); 42 debug('Added an employee inside the transaction.');
42 } 43 }
43 44
44 function onSetVersionComplete() 45 function onSetVersionComplete()
45 { 46 {
46 debug('Creating new transaction.'); 47 debug('Creating new transaction.');
47 var newTransaction = db.transaction([], IDBTransaction.READ_WRITE, 0); 48 var newTransaction = db.transaction({objectStoreNames: [], mode: IDBTransactio n.READ_WRITE});
48 newTransaction.oncomplete = newTransactionCompleted; 49 newTransaction.oncomplete = newTransactionCompleted;
49 newTransaction.onabort = newTransactionAborted; 50 newTransaction.onabort = newTransactionAborted;
50 51
51 var request = newTransaction.objectStore('employees').put( 52 var request = newTransaction.objectStore('employees').put(
52 {id: 0, name: 'John Doe', desk: 'LON-BEL-123'}); 53 {id: 0, name: 'John Doe', desk: 'LON-BEL-123'});
53 request.onsuccess = employeeAdded; 54 request.onsuccess = employeeAdded;
54 request.onerror = unexpectedErrorCallback; 55 request.onerror = unexpectedErrorCallback;
55 56
56 newTransaction.abort(); 57 newTransaction.abort();
57 } 58 }
(...skipping 25 matching lines...) Expand all
83 IDBCursor = webkitIDBCursor; 84 IDBCursor = webkitIDBCursor;
84 IDBKeyRange = webkitIDBKeyRange; 85 IDBKeyRange = webkitIDBKeyRange;
85 IDBTransaction = webkitIDBTransaction; 86 IDBTransaction = webkitIDBTransaction;
86 } 87 }
87 88
88 debug('Connecting to indexedDB.'); 89 debug('Connecting to indexedDB.');
89 var result = indexedDB.open('name'); 90 var result = indexedDB.open('name');
90 result.onsuccess = setVersion; 91 result.onsuccess = setVersion;
91 result.onerror = unexpectedErrorCallback; 92 result.onerror = unexpectedErrorCallback;
92 } 93 }
OLDNEW
« no previous file with comments | « chrome/test/data/indexeddb/transaction_run_forever.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698