Index: Source/modules/indexeddb/IDBObjectStore.cpp |
diff --git a/Source/modules/indexeddb/IDBObjectStore.cpp b/Source/modules/indexeddb/IDBObjectStore.cpp |
index 8f6b4ae18ea3e23b55196b426ef67cfdd821d4a1..2ac8e0fc6409dc5b298bdd4cf7dc3cde7242f714 100644 |
--- a/Source/modules/indexeddb/IDBObjectStore.cpp |
+++ b/Source/modules/indexeddb/IDBObjectStore.cpp |
@@ -163,16 +163,12 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(IDBDatabaseBackendInterface::PutMode |
// FIXME: Make serialize etc take an ExceptionState or use ScriptState::setDOMException. |
bool didThrow = false; |
- RefPtr<SerializedScriptValue> serializedValue = value.serialize(state, 0, 0, didThrow); |
+ Vector<BlobInfo> blobInfo; |
+ RefPtr<SerializedScriptValue> serializedValue = value.serialize(state, &blobInfo, didThrow); |
+ ASSERT(serializedValue->blobInfo() == &blobInfo); |
if (didThrow) |
return 0; |
- if (serializedValue->blobURLs().size() > 0) { |
- // FIXME: Add Blob/File/FileList support |
- es.throwDOMException(DataCloneError); |
- return 0; |
- } |
- |
const IDBKeyPath& keyPath = m_metadata.keyPath; |
const bool usesInLineKeys = !keyPath.isNull(); |
const bool hasKeyGenerator = autoIncrement(); |
@@ -225,7 +221,15 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(IDBDatabaseBackendInterface::PutMode |
Vector<char> wireBytes; |
serializedValue->toWireBytes(wireBytes); |
RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); |
- backendDB()->put(m_transaction->id(), id(), valueBuffer, key.release(), static_cast<IDBDatabaseBackendInterface::PutMode>(putMode), request, indexIds, indexKeys); |
+ backendDB()->put(m_transaction->id(), id(), valueBuffer, serializedValue->blobInfo(), key.release(), static_cast<IDBDatabaseBackendInterface::PutMode>(putMode), request, indexIds, indexKeys); |
jsbell
2013/09/12 22:52:17
If we remove m_blobInfo from SSV, this can just th
ericu
2013/11/20 23:06:08
Done.
|
+ // TODO(ericu): Hold a reference to each blob in serializedValue->blobInfo() |
jsbell
2013/09/12 22:52:17
Adding a vector of blob refs to IDBTransaction sou
ericu
2013/11/20 23:06:08
Updated TODO.
|
+ // until the transaction's committed or this value is overwritten or |
+ // otherwise removed. We have to grab it here, rather than the backend, to |
+ // avoid a race. Blobs live on the IO thread in the backend, and IDB |
+ // requests are handled on the IDB task runner; if we grabbed the blob |
+ // references on the IO thread before switching to the IDB task runner, that |
+ // would work too, but it's probably safer to have the refs held in the |
+ // renderer, in case of crashes, request failures, etc. |
return request.release(); |
} |