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.
7 // Do not use indexedDBTest() - need to specify the database name
8 var dbname = "doesnt-hang-test";
10 var request = indexedDB.deleteDatabase(dbname);
11 request.onerror = unexpectedErrorCallback;
12 request.onblocked = unexpectedBlockedCallback;
13 request.onsuccess = function() {
14 var request = indexedDB.open(dbname, 1);
15 request.onerror = unexpectedErrorCallback;
16 request.onblocked = unexpectedBlockedCallback;
17 request.onupgradeneeded = onUpgradeNeeded;
18 request.onsuccess = onOpenSuccess;
22 function onUpgradeNeeded()
24 // We are now in a set version transaction.
25 debug('Creating object store.');
26 var db = event.target.result;
27 db.createObjectStore('store');
32 function onOpenSuccess()
34 var db = event.target.result;
36 debug('Creating new transaction.');
37 var transaction = db.transaction('store', 'readwrite');
38 transaction.oncomplete = unexpectedCompleteCallback;
39 transaction.onabort = unexpectedAbortCallback;
40 objectStore = transaction.objectStore('store');
42 debug('Starting endless loop...');
47 function endlessLoop()
49 var request = objectStore.get(0);
50 request.onsuccess = endlessLoop;
51 request.onerror = unexpectedErrorCallback;
55 // If we've already looped 7 times, it's pretty safe to assume
56 // we'll continue looping for some time...
57 debug("Looping infinitely within a transaction.");