4 Copyright 2015 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file.
9 <title>IDB Test that reading a blob from the database does send an ack back to browser process
</title>
10 <script src=
"common.js"></script>
14 var store_name
= 'blobs_ack';
15 var blob_key
= 'blob_key';
23 indexedDBTest(prepareDatabase
, putBlob
);
26 function prepareDatabase() {
27 db
= event
.target
.result
;
28 db
.createObjectStore(store_name
);
32 debug("Writing blob.");
34 var trans
= db
.transaction(store_name
, 'readwrite');
35 trans
.onabort
= unexpectedAbortCallback
;
36 trans
.oncomplete
= getBlob
;
38 var data
= new Array(1 + blob_size
).join("X");
39 put_blob
= new Blob([data
]);
40 var request
= trans
.objectStore(store_name
).put(put_blob
, blob_key
);
41 request
.onerror
= unexpectedErrorCallback
;
45 debug("Deleting blob.");
46 put_blob
= undefined; // So that the blob can be GC'd
47 var trans
= db
.transaction(store_name
, 'readonly');
48 trans
.onabort
= unexpectedAbortCallback
;
49 trans
.oncomplete
= onGetComplete
;
51 var request
= trans
.objectStore(store_name
).get(blob_key
);
52 request
.onerror
= unexpectedErrorCallback
;
55 function onGetComplete() {
62 <body onLoad=
"test()">
63 <div id=
"status">Starting...
<br>
64 <p>Run this test with --js-flags=--expose-gc when run from Chrome.
</p>