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 unused cursor prefetches are acked back to browser process
</title>
10 <script src=
"common.js"></script>
14 var store_name
= 'prefetch_blobs_ack';
15 var kNumToFetch
= 15; // Enough to trigger prefetch, but not on a batch boundary.
21 indexedDBTest(prepareDatabase
, iterateCursor
);
24 function prepareDatabase() {
25 db
= event
.target
.result
;
26 var store
= db
.createObjectStore(store_name
);
27 for (var i
= 0; i
< kNumToFetch
+ 10; ++i
)
28 store
.put(new Blob([String(i
)]), i
);
31 function iterateCursor() {
32 var tx
= db
.transaction(store_name
, 'readonly');
33 var count
= kNumToFetch
;
34 var request
= tx
.objectStore(store_name
).openCursor();
35 request
.onerror
= unexpectedErrorCallback
;
36 request
.onsuccess = function() {
38 request
.result
.continue();
40 tx
.onabort
= unexpectedAbortCallback
;
41 tx
.oncomplete
= onComplete
;
44 function onComplete() {
51 <body onLoad=
"test()">
52 <div id=
"status">Starting...
<br>
53 <p>Run this test with --js-flags=--expose-gc when run from Chrome.
</p>