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

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: Roll in most of Josh's feedback. 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 debug("");
28 debug("reopen():");
29 request = indexedDB.open(dbname, 2);
jsbell 2014/06/02 23:05:06 For consistency, evalAndLog() this?
ericu 2014/06/02 23:53:07 Done.
30 request.onupgradeneeded = deleteObjectStore;
31 request.onsuccess = unexpectedSuccessCallback;
32 request.onerror = unexpectedErrorCallback;
33 request.onblocked = unexpectedBlockedCallback;
34 }
35
36 function deleteObjectStore(e)
37 {
38 debug("");
39 debug("deleteObjectStore():");
jsbell 2014/06/02 23:05:06 Could use preamble();
ericu 2014/06/02 23:53:07 Done.
40 db = e.target.result;
41 evalAndLog("db.deleteObjectStore('store0')");
42 request.onsuccess = didDeleteObjectStore;
43 }
44
45 function didDeleteObjectStore()
46 {
47 debug("");
48 debug("didDeleteObjectStore()");
jsbell 2014/06/02 23:05:06 Could use preamble();
ericu 2014/06/02 23:53:07 Done.
49 blobBContent = "Second blob content";
50 evalAndLog("trans = db.transaction('store1', 'readwrite')");
51 evalAndLog("store1 = trans.objectStore('store1')");
52 blobB = new Blob([blobBContent], {"type" : "text/plain"});
53 evalAndLog("store1.put(blobB, key)");
54 trans.oncomplete = deleteDatabase;
jsbell 2014/06/02 23:05:06 Paranoia: add trans.onabort = unexpectedAbortCallb
ericu 2014/06/02 23:53:07 Done.
55 }
56
57 function deleteDatabase()
58 {
59 evalAndLog("db.close()");
60 evalAndLog("request = indexedDB.deleteDatabase(dbname)");
61 request.onerror = unexpectedErrorCallback;
62 request.onsuccess = reportSuccess;
63 }
64
65 function reportSuccess()
66 {
67 debug("Database deleted.");
68 finishJSTest();
69 }
70 </script>
71 </body>
72 </html>
73
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698