• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2013 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
5function test()
6{
7  // Do not use indexedDBTest() - need to re-use previous database.
8  var dbname = "doesnt-hang-test";
9  var request = indexedDB.open(dbname);
10  request.onerror = unexpectedErrorCallback;
11  request.onblocked = unexpectedBlockedCallback;
12  request.onupgradeneeded = unexpectedUpgradeNeededCallback;
13  request.onsuccess = onOpenSuccess;
14}
15
16function onOpenSuccess()
17{
18  var db = event.target.result;
19
20  debug('Creating new transaction.');
21  var transaction = db.transaction('store', 'readwrite');
22  transaction.onabort = unexpectedAbortCallback;
23  var objectStore = transaction.objectStore('store');
24
25  var request = objectStore.get(0);
26  request.onerror = unexpectedErrorCallback;
27  request.onsuccess = function() {
28    debug("request completed successfully");
29  };
30
31  transaction.oncomplete = function() {
32    debug("transaction completed");
33    done();
34  };
35}
36