Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 <iframe id="frame0"></iframe> | |
| 8 <iframe id="frame1"></iframe> | |
| 9 <iframe id="frame2"></iframe> | |
| 10 <script> | |
| 11 | |
| 12 description("Confirm that blobs can be read back before their records are commit ted."); | |
| 13 | |
| 14 indexedDBTest(prepareDatabase); | |
| 15 function prepareDatabase() | |
| 16 { | |
| 17 db = event.target.result; | |
| 18 event.target.transaction.onabort = unexpectedAbortCallback; | |
| 19 evalAndLog("store = db.createObjectStore('store')"); | |
| 20 blobAContent = "Blob A content"; | |
| 21 blobBContent = "Blob B content"; | |
| 22 var blobA = new Blob([blobAContent], {"type" : "text\/plain"}); | |
| 23 var blobB = new Blob([blobBContent], {"type" : "text\/plain"}); | |
| 24 key = "key" | |
| 25 value = { a0: blobA, a1: blobA, b0: blobB }; | |
| 26 evalAndLog("store.put(value, key)"); | |
| 27 evalAndLog("request = store.get(key)"); | |
| 28 request.onsuccess = didRead; | |
| 29 } | |
| 30 | |
| 31 function didRead() | |
| 32 { | |
| 33 record = request.result; | |
| 34 urlA0 = URL.createObjectURL(record.a0); | |
| 35 urlA1 = URL.createObjectURL(record.a1); | |
| 36 urlB = URL.createObjectURL(record.b0); | |
| 37 document.getElementById('frame0').src = urlA0; | |
| 38 document.getElementById('frame0').onload = verification; | |
| 39 document.getElementById('frame1').src = urlA1; | |
| 40 document.getElementById('frame1').onload = verification; | |
| 41 document.getElementById('frame2').src = urlB; | |
| 42 document.getElementById('frame2').onload = verification; | |
| 43 } | |
| 44 | |
| 45 var loadCount = 0; | |
| 46 function verification() | |
| 47 { | |
| 48 if (++loadCount < 3) | |
| 49 return; | |
| 50 delete record; | |
| 51 record = null; | |
|
cmumford
2014/06/04 21:01:19
Do you need to set record to null?
jsbell
2014/06/04 21:56:26
Ditto (pointed out/missed/harmless/useless)
ericu
2014/06/06 22:57:00
Done.
| |
| 52 URL.revokeObjectURL(urlA0); | |
| 53 URL.revokeObjectURL(urlA1); | |
| 54 URL.revokeObjectURL(urlB); | |
| 55 shouldBe("document.getElementById('frame0').contentDocument.body.innerText", | |
| 56 "blobAContent"); | |
| 57 shouldBe("document.getElementById('frame1').contentDocument.body.innerText", | |
| 58 "blobAContent"); | |
| 59 shouldBe("document.getElementById('frame2').contentDocument.body.innerText", | |
| 60 "blobBContent"); | |
| 61 finishJSTest(); | |
| 62 } | |
| 63 | |
| 64 </script> | |
| 65 </body> | |
| 66 </html> | |
| 67 | |
| OLD | NEW |