Add ICU message format support
[chromium-blink-merge.git] / content / test / data / indexeddb / version_change_blocked.js
bloba1893feec6a14cfbc7b23c4253bb6d96da6b2ac8
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.
5 function test()
7 if (document.location.hash === '#tab1') {
8 prepareDatabase(function () { doSetVersion(2); });
9 } else if (document.location.hash === '#tab2') {
10 doSetVersion(3);
11 } else {
12 result('fail - unexpected hash');
16 function prepareDatabase(callback)
18 // Prepare the database, then exit normally
19 var delreq = window.indexedDB.deleteDatabase('version-change-blocked');
20 delreq.onerror = unexpectedErrorCallback;
21 delreq.onsuccess = function() {
22 reOpen(callback);
26 function reOpen(callback)
28 request = indexedDB.open('version-change-blocked');
29 request.onerror = unexpectedErrorCallback;
30 request.onblocked = unexpectedBlockedCallback;
31 request.onupgradeneeded = function() {
32 db = event.target.result;
33 db.createObjectStore("someobjectstore");
35 request.onsuccess = function() {
36 db.close();
37 callback();
41 function doSetVersion(version)
43 // Open the database and try a setVersion
44 var openreq = window.indexedDB.open('version-change-blocked', version);
45 openreq.onerror = unexpectedErrorCallback;
46 var upgradeneededComplete = false;
47 openreq.onblocked = function(e) {
48 result('setVersion(' + version + ') blocked');
50 openreq.onupgradeneeded = function(e) {
51 openreq.transaction.oncomplete = function(e2) {
52 db = openreq.result;
53 result('setVersion(' + version + ') complete');