[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / test / data / indexeddb / blob_did_ack_prefetch.html
blob333c2e95726be8b7431a4fb817ad969a753e6fe8
1 <!DOCTYPE html>
2 <html>
3 <!--
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.
7 -->
8 <head>
9 <title>IDB Test that unused cursor prefetches are acked back to browser process</title>
10 <script src="common.js"></script>
11 <script>
13 // Constants.
14 var store_name = 'prefetch_blobs_ack';
15 var kNumToFetch = 15; // Enough to trigger prefetch, but not on a batch boundary.
17 // Shared variables.
18 var db;
20 function test() {
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() {
37 if (--count > 0)
38 request.result.continue();
40 tx.onabort = unexpectedAbortCallback;
41 tx.oncomplete = onComplete;
44 function onComplete() {
45 gc();
46 done();
49 </script>
50 </head>
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>
54 </div>
55 </body>
56 </html>