Skip to content

Instantly share code, notes, and snippets.

@uupaa
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save uupaa/e53654d4c6cf9fda4be7 to your computer and use it in GitHub Desktop.

Select an option

Save uupaa/e53654d4c6cf9fda4be7 to your computer and use it in GitHub Desktop.
  • StorageLimit
    • NW-Z1050 33MB
    • Nexus 7 770MB
  • iPhone5 IndexedDB は blob は非サポート、arraybuffer では 200MB 以上利用可能。500MB使っても落ちない

Webkit does not support Blob in IndexedDB.

http://trac.webkit.org/changeset/163923 - IDB: Reimport storage/indexeddb tests from Blink

178         if (serializedValue->hasBlobURLs()) {
179	        // FIXME: Add Blob/File/FileList support
180	        ec = IDBDatabaseException::DataCloneError;
181	        return 0;
182	    }
    if (serializedValue->hasBlobURLs()) {
        // FIXME: Add Blob/File/FileList support
        ec = IDBDatabaseException::DataCloneError;
        return nullptr;
    }
Vector<WebBlobInfo> blobInfo;
    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, &blobInfo, exceptionState, scriptState->isolate());
    if (exceptionState.hadException())
        return 0;

https://chromium.googlesource.com/chromium/blink/+/253029b85fb8c5313e61b26987d830694a75ab94/LayoutTests/storage/indexeddb/noblobs-expected.txt

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
Exception message: Failed to execute 'put' on 'IDBObjectStore': The object store currently does not support blob values.
Expecting exception from store.add(blob, 'key')
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: Failed to execute 'add' on 'IDBObjectStore': The object store currently does not support blob values.
request = store.openCursor()
cursor = request.result
Expecting exception from cursor.update(blob)
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: Failed to execute 'update' on 'IDBCursor': The object store currently does not support blob values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment