Index: content/test/data/indexeddb/blob_did_ack.html |
diff --git a/content/test/data/indexeddb/blob_did_ack.html b/content/test/data/indexeddb/blob_did_ack.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..515e24bf88a8f4f1f9efbea5b0e64a0f8f790605 |
--- /dev/null |
+++ b/content/test/data/indexeddb/blob_did_ack.html |
@@ -0,0 +1,67 @@ |
+<!DOCTYPE html> |
+<html> |
+<!-- |
+ Copyright 2015 The Chromium Authors. All rights reserved. |
+ Use of this source code is governed by a BSD-style license that can be |
+ found in the LICENSE file. |
+--> |
+<head> |
+<title>IDB Test that reading a blob from the database does send an ack back to browser process</title> |
+<script src="common.js"></script> |
+<script> |
+ |
+// Constants. |
+var store_name = 'blobs_ack'; |
+var blob_key = 'blob_key'; |
+var blob_size = 200; |
+ |
+// Shared variables. |
+var db; |
+var put_blob; |
+ |
+function test() { |
+ indexedDBTest(prepareDatabase, putBlob); |
+} |
+ |
+function prepareDatabase() { |
+ db = event.target.result; |
+ db.createObjectStore(store_name); |
+} |
+ |
+function putBlob() { |
+ debug("Writing blob."); |
+ |
+ var trans = db.transaction(store_name, 'readwrite'); |
+ trans.onabort = unexpectedAbortCallback; |
+ trans.oncomplete = getBlob; |
+ |
+ var data = new Array(1 + blob_size).join("X"); |
+ put_blob = new Blob([data]); |
+ var request = trans.objectStore(store_name).put(put_blob, blob_key); |
+ request.onerror = unexpectedErrorCallback; |
+} |
+ |
+function getBlob() { |
+ debug("Deleting blob."); |
+ put_blob = undefined; // So that the blob can be GC'd |
+ var trans = db.transaction(store_name, 'readonly'); |
+ trans.onabort = unexpectedAbortCallback; |
+ trans.oncomplete = onGetComplete; |
+ |
+ var request = trans.objectStore(store_name).get(blob_key); |
+ request.onerror = unexpectedErrorCallback; |
+} |
+ |
+function onGetComplete() { |
+ gc(); |
+ done(); |
+} |
+ |
+</script> |
+</head> |
+<body onLoad="test()"> |
+ <div id="status">Starting...<br> |
+ <p>Run this test with --js-flags=--expose-gc when run from Chrome.</p> |
+ </div> |
+</body> |
+</html> |