Index: Source/modules/indexeddb/IDBObjectStore.cpp |
diff --git a/Source/modules/indexeddb/IDBObjectStore.cpp b/Source/modules/indexeddb/IDBObjectStore.cpp |
index 6b5e375a910bd72b73a673edbdb4fa33a03487c0..e7cb34750329d20b1780bb53bbcd61a4933d9f6e 100644 |
--- a/Source/modules/indexeddb/IDBObjectStore.cpp |
+++ b/Source/modules/indexeddb/IDBObjectStore.cpp |
@@ -41,12 +41,17 @@ |
#include "modules/indexeddb/IDBTransaction.h" |
#include "modules/indexeddb/WebIDBCallbacksImpl.h" |
#include "platform/SharedBuffer.h" |
+#include "platform/blob/BlobInfo.h" |
+#include "public/platform/WebBlobInfo.h" |
#include "public/platform/WebData.h" |
#include "public/platform/WebIDBKey.h" |
#include "public/platform/WebIDBKeyRange.h" |
+#include "public/platform/WebVector.h" |
+using blink::WebBlobInfo; |
using blink::WebIDBDatabase; |
using blink::WebIDBCallbacks; |
+using blink::WebVector; |
namespace WebCore { |
@@ -164,16 +169,11 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(WebIDBDatabase::PutMode putMode, Pass |
// FIXME: Make SerializedScriptValue::create etc take an ExceptionState or use ScriptState::setDOMException. |
bool didThrow = false; |
- RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, didThrow, state); |
+ Vector<BlobInfo> blobInfo; |
+ RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, &blobInfo, didThrow, state); |
if (didThrow) |
return 0; |
- if (serializedValue->containsBlobs()) { |
- // FIXME: Add Blob/File/FileList support |
- exceptionState.throwUninformativeAndGenericDOMException(DataCloneError); |
- return 0; |
- } |
- |
const IDBKeyPath& keyPath = m_metadata.keyPath; |
const bool usesInLineKeys = !keyPath.isNull(); |
const bool hasKeyGenerator = autoIncrement(); |
@@ -226,7 +226,17 @@ PassRefPtr<IDBRequest> IDBObjectStore::put(WebIDBDatabase::PutMode putMode, Pass |
Vector<char> wireBytes; |
serializedValue->toWireBytes(wireBytes); |
RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); |
- backendDB()->put(m_transaction->id(), id(), blink::WebData(valueBuffer), key.release(), static_cast<WebIDBDatabase::PutMode>(putMode), WebIDBCallbacksImpl::create(request).leakPtr(), indexIds, indexKeys); |
+ |
+ WebVector<WebBlobInfo> webBlobInfo(blobInfo.size()); |
+ for (size_t i = 0; i < blobInfo.size(); ++i) { |
+ const WebCore::BlobInfo& info = blobInfo[i]; |
+ if (info.isFile()) |
+ webBlobInfo[i] = WebBlobInfo(info.uuid(), info.filePath(), info.fileName(), info.type()); |
+ else |
+ webBlobInfo[i] = WebBlobInfo(info.uuid(), info.type(), info.size()); |
+ } |
+ |
+ backendDB()->put(m_transaction->id(), id(), blink::WebData(valueBuffer), webBlobInfo, key.release(), static_cast<WebIDBDatabase::PutMode>(putMode), WebIDBCallbacksImpl::create(request).leakPtr(), indexIds, indexKeys); |
return request.release(); |
} |