2 self
.addEventListener('message', function(e
) {
5 doIndexedDBTest(message
.port
);
8 function doIndexedDBTest(port
) {
9 var delete_request
= indexedDB
.deleteDatabase('db');
10 delete_request
.onsuccess = function() {
11 var open_request
= indexedDB
.open('db');
12 open_request
.onupgradeneeded = function() {
13 var db
= open_request
.result
;
14 db
.createObjectStore('store');
16 open_request
.onsuccess = function() {
17 var db
= open_request
.result
;
18 var tx
= db
.transaction('store', 'readwrite');
19 var store
= tx
.objectStore('store');
20 store
.put('value', 'key');
21 tx
.oncomplete = function() {
22 port
.postMessage('done');