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