OLD | NEW |
1 Confirm Blob/File/FileList limitations of WebKit's IndexedDB implementation. | 1 Confirm Blob/File/FileList limitations of WebKit's IndexedDB implementation. |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; | 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; |
7 | 7 |
8 dbname = "noblobs.html" | 8 dbname = "noblobs.html" |
9 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
11 store = db.createObjectStore('storeName') | 11 store = db.createObjectStore('storeName') |
12 store.put('value', 'key') | 12 store.put('value', 'key') |
13 | 13 |
14 testBlob(): | 14 testBlob(): |
15 PASS FileReader != null is true | 15 PASS FileReader != null is true |
16 test_content = 'This is a test. This is only a test.' | 16 test_content = 'This is a test. This is only a test.' |
17 blob = new Blob([test_content]) | 17 blob = new Blob([test_content]) |
18 | 18 |
19 validateExceptions(blob): | 19 validateExceptions(blob): |
20 transaction = db.transaction('storeName', 'readwrite') | 20 transaction = db.transaction('storeName', 'readwrite') |
21 store = transaction.objectStore('storeName') | 21 store = transaction.objectStore('storeName') |
22 Expecting exception from store.put(blob, 'key') | 22 Expecting exception from store.put(blob, 'key') |
23 PASS Exception was thrown. | 23 PASS Exception was thrown. |
24 PASS code is DOMException.DATA_CLONE_ERR | 24 PASS code is DOMException.DATA_CLONE_ERR |
| 25 Exception message: An object could not be cloned. |
25 Expecting exception from store.add(blob, 'key') | 26 Expecting exception from store.add(blob, 'key') |
26 PASS Exception was thrown. | 27 PASS Exception was thrown. |
27 PASS code is DOMException.DATA_CLONE_ERR | 28 PASS code is DOMException.DATA_CLONE_ERR |
| 29 Exception message: An object could not be cloned. |
28 request = store.openCursor() | 30 request = store.openCursor() |
29 cursor = request.result | 31 cursor = request.result |
30 Expecting exception from cursor.update(blob) | 32 Expecting exception from cursor.update(blob) |
31 PASS Exception was thrown. | 33 PASS Exception was thrown. |
32 PASS code is DOMException.DATA_CLONE_ERR | 34 PASS code is DOMException.DATA_CLONE_ERR |
| 35 Exception message: An object could not be cloned. |
33 | 36 |
34 testFile(): | 37 testFile(): |
35 file = fileInput.files[0] | 38 file = fileInput.files[0] |
36 | 39 |
37 validateExceptions(file): | 40 validateExceptions(file): |
38 transaction = db.transaction('storeName', 'readwrite') | 41 transaction = db.transaction('storeName', 'readwrite') |
39 store = transaction.objectStore('storeName') | 42 store = transaction.objectStore('storeName') |
40 Expecting exception from store.put(file, 'key') | 43 Expecting exception from store.put(file, 'key') |
41 PASS Exception was thrown. | 44 PASS Exception was thrown. |
42 PASS code is DOMException.DATA_CLONE_ERR | 45 PASS code is DOMException.DATA_CLONE_ERR |
| 46 Exception message: An object could not be cloned. |
43 Expecting exception from store.add(file, 'key') | 47 Expecting exception from store.add(file, 'key') |
44 PASS Exception was thrown. | 48 PASS Exception was thrown. |
45 PASS code is DOMException.DATA_CLONE_ERR | 49 PASS code is DOMException.DATA_CLONE_ERR |
| 50 Exception message: An object could not be cloned. |
46 request = store.openCursor() | 51 request = store.openCursor() |
47 cursor = request.result | 52 cursor = request.result |
48 Expecting exception from cursor.update(file) | 53 Expecting exception from cursor.update(file) |
49 PASS Exception was thrown. | 54 PASS Exception was thrown. |
50 PASS code is DOMException.DATA_CLONE_ERR | 55 PASS code is DOMException.DATA_CLONE_ERR |
| 56 Exception message: An object could not be cloned. |
51 | 57 |
52 testFileList(): | 58 testFileList(): |
53 filelist = fileInput.files | 59 filelist = fileInput.files |
54 | 60 |
55 validateExceptions(filelist): | 61 validateExceptions(filelist): |
56 transaction = db.transaction('storeName', 'readwrite') | 62 transaction = db.transaction('storeName', 'readwrite') |
57 store = transaction.objectStore('storeName') | 63 store = transaction.objectStore('storeName') |
58 Expecting exception from store.put(filelist, 'key') | 64 Expecting exception from store.put(filelist, 'key') |
59 PASS Exception was thrown. | 65 PASS Exception was thrown. |
60 PASS code is DOMException.DATA_CLONE_ERR | 66 PASS code is DOMException.DATA_CLONE_ERR |
| 67 Exception message: An object could not be cloned. |
61 Expecting exception from store.add(filelist, 'key') | 68 Expecting exception from store.add(filelist, 'key') |
62 PASS Exception was thrown. | 69 PASS Exception was thrown. |
63 PASS code is DOMException.DATA_CLONE_ERR | 70 PASS code is DOMException.DATA_CLONE_ERR |
| 71 Exception message: An object could not be cloned. |
64 request = store.openCursor() | 72 request = store.openCursor() |
65 cursor = request.result | 73 cursor = request.result |
66 Expecting exception from cursor.update(filelist) | 74 Expecting exception from cursor.update(filelist) |
67 PASS Exception was thrown. | 75 PASS Exception was thrown. |
68 PASS code is DOMException.DATA_CLONE_ERR | 76 PASS code is DOMException.DATA_CLONE_ERR |
| 77 Exception message: An object could not be cloned. |
69 PASS successfullyParsed is true | 78 PASS successfullyParsed is true |
70 | 79 |
71 TEST COMPLETE | 80 TEST COMPLETE |
72 | 81 |
OLD | NEW |