Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: LayoutTests/storage/indexeddb/blob-delete-objectstore-db.html

Issue 18590006: Blob support for IDB [Blink] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: aaaaaaaand one more nit. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script src="resources/shared.js"></script>
5 </head>
6 <body>
7 <script>
8
9 description("Test that deleting an object store and a database containing blobs doesn't crash.");
10
11 indexedDBTest(prepareDatabase, reopen, {version: 1});
12 function prepareDatabase()
13 {
14 db = event.target.result;
15 event.target.transaction.onabort = unexpectedAbortCallback;
16 evalAndLog("store0 = db.createObjectStore('store0')");
17 evalAndLog("store1 = db.createObjectStore('store1')");
18 blobAContent = "First blob content";
19 blobA = new Blob([blobAContent], {"type" : "text/plain"});
20 key = "blob key";
21 evalAndLog("store0.put(blobA, key)");
22 }
23
24 function reopen()
25 {
26 evalAndLog("db.close()");
27 preamble();
28 evalAndLog("request = indexedDB.open(dbname, 2)");
29 request.onupgradeneeded = deleteObjectStore;
30 request.onsuccess = unexpectedSuccessCallback;
31 request.onerror = unexpectedErrorCallback;
32 request.onblocked = unexpectedBlockedCallback;
33 }
34
35 function deleteObjectStore(e)
36 {
37 preamble();
38 db = e.target.result;
39 evalAndLog("db.deleteObjectStore('store0')");
40 request.onsuccess = didDeleteObjectStore;
41 }
42
43 function didDeleteObjectStore()
44 {
45 preamble();
46 blobBContent = "Second blob content";
47 evalAndLog("trans = db.transaction('store1', 'readwrite')");
48 evalAndLog("store1 = trans.objectStore('store1')");
49 blobB = new Blob([blobBContent], {"type" : "text/plain"});
50 evalAndLog("store1.put(blobB, key)");
51 trans.oncomplete = deleteDatabase;
52 trans.onabort = unexpectedAbortCallback;
53 }
54
55 function deleteDatabase()
56 {
57 evalAndLog("db.close()");
58 evalAndLog("request = indexedDB.deleteDatabase(dbname)");
59 request.onerror = unexpectedErrorCallback;
60 request.onsuccess = reportSuccess;
61 }
62
63 function reportSuccess()
64 {
65 debug("Database deleted.");
66 finishJSTest();
67 }
68 </script>
69 </body>
70 </html>
71
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698