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 if (document
.location
.hash
=== '#part1') {
9 } else if (document
.location
.hash
=== '#part2') {
12 result('fail - unexpected hash');
18 var delreq
= window
.indexedDB
.deleteDatabase('bug90635');
19 delreq
.onerror
= unexpectedErrorCallback
;
20 delreq
.onsuccess = function() {
21 var openreq
= window
.indexedDB
.open('bug90635', 1);
22 openreq
.onerror
= unexpectedErrorCallback
;
23 openreq
.onblocked
= unexpectedBlockedCallback
;
24 openreq
.onupgradeneeded = function(e
) {
26 var transaction
= openreq
.transaction
;
27 transaction
.onabort
= unexpectedAbortCallback
;
29 db
.createObjectStore('store1');
30 db
.createObjectStore('store2', {keyPath
: ''});
31 db
.createObjectStore('store3', {keyPath
: 'some_path'});
33 openreq
.onsuccess = function() {
34 test_store(db
, 'first run');
41 var openreq
= window
.indexedDB
.open('bug90635');
42 openreq
.onerror
= unexpectedErrorCallback
;
43 openreq
.onsuccess = function(e
) {
44 var db
= openreq
.result
;
45 test_store(db
, 'second run');
49 function test_store(db
, msg
) {
50 var transaction
= db
.transaction(['store1', 'store2', 'store3'], 'readonly');
51 var store1
= transaction
.objectStore('store1');
52 var store2
= transaction
.objectStore('store2');
53 var store3
= transaction
.objectStore('store3');
55 if (store1
.keyPath
!== null ||
56 store2
.keyPath
!== '' ||
57 store3
.keyPath
!== 'some_path') {
58 result('fail - ' + msg
);
60 result('pass - ' + msg
);