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;


Prepare Database
indexedDB.deleteDatabase('noblobs')
indexedDB.open('noblobs')
db = request.result
PASS db.version is ""
db.setVersion('1')
store = db.createObjectStore('storeName')
store.put('value', 'key')

testBlob():
BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder
PASS BlobBuilder != null is true
PASS FileReader != null is true
builder = new BlobBuilder()
test_content = 'This is a test. This is only a test.'
builder.append(test_content)
blob = builder.getBlob()

validateExceptions(blob):
transaction = db.transaction('storeName', IDBTransaction.READ_WRITE)
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', IDBTransaction.READ_WRITE)
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', IDBTransaction.READ_WRITE)
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

