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. 4 5 function test() 6 { 7 var dbbase = "callback_accounting_"; 8 9 var request1 = indexedDB.open(dbbase + 1); 10 11 request1.onupgradeneeded = function() { 12 debug("request1 open onupgradeneeded"); 13 request1.result.createObjectStore('store'); 14 }; 15 16 request1.onsuccess = function() { 17 debug("request1 open onsuccess"); 18 19 var db1 = request1.result; 20 var transaction = db1.transaction('store'); 21 transaction.onabort = unexpectedAbortCallback; 22 23 debug("transaction created and looping"); 24 endTransaction = false; 25 transactionRunning = true; 26 function loop() { 27 if (!endTransaction) { 28 transaction.objectStore('store').get(0).onsuccess = loop; 29 } 30 } 31 loop(); 32 33 var request2 = indexedDB.open(dbbase + 2); 34 35 request2.onsuccess = function() { 36 debug("request2 open onsuccess"); 37 38 shouldBeTrue("transactionRunning"); 39 var db2 = request2.result; 40 db2.close(); 41 debug("db2 close2"); 42 endTransaction = true; 43 debug("ending transaction"); 44 }; 45 46 transaction.oncomplete = function() { 47 debug("transaction oncomplete"); 48 shouldBeTrue("endTransaction"); 49 done(); 50 }; 51 }; 52 } 53