Confirm Blob/File/FileList limitations of WebKit's IndexedDB implementation.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;

dbname = "noblobs.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('storeName')
store.put('value', 'key')

testBlob():
PASS FileReader != null is true
test_content = 'This is a test. This is only a test.'
blob = new Blob([test_content])

validateExceptions(blob):
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
Expecting exception from store.put(blob, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Expecting exception from store.add(blob, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
request = store.openCursor()
cursor = request.result
Expecting exception from cursor.update(blob)
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR

testFile():
file = fileInput.files[0]

validateExceptions(file):
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
Expecting exception from store.put(file, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Expecting exception from store.add(file, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
request = store.openCursor()
cursor = request.result
Expecting exception from cursor.update(file)
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR

testFileList():
filelist = fileInput.files

validateExceptions(filelist):
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
Expecting exception from store.put(filelist, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Expecting exception from store.add(filelist, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
request = store.openCursor()
cursor = request.result
Expecting exception from cursor.update(filelist)
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
PASS successfullyParsed is true

TEST COMPLETE

