| Index: Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
|
| ===================================================================
|
| --- Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (revision 132819)
|
| +++ Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (working copy)
|
| @@ -105,11 +105,11 @@
|
| }
|
|
|
| static void generateIndexKeysForValue(const IDBIndexMetadata& indexMetadata,
|
| - const ScriptValue& objectValue,
|
| + PassRefPtr<SerializedScriptValue> objectValue,
|
| IDBObjectStore::IndexKeys* indexKeys)
|
| {
|
| ASSERT(indexKeys);
|
| - RefPtr<IDBKey> indexKey = createIDBKeyFromScriptValueAndKeyPath(objectValue, indexMetadata.keyPath);
|
| + RefPtr<IDBKey> indexKey = createIDBKeyFromSerializedValueAndKeyPath(objectValue, indexMetadata.keyPath);
|
|
|
| if (!indexKey)
|
| return;
|
| @@ -129,21 +129,22 @@
|
| }
|
| }
|
|
|
| -PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, ScriptValue& value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
|
| +PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
|
| {
|
| IDB_TRACE("IDBObjectStore::add");
|
| return put(IDBObjectStoreBackendInterface::AddOnly, IDBAny::create(this), context, value, key, ec);
|
| }
|
|
|
| -PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, ScriptValue& value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
|
| +PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
|
| {
|
| IDB_TRACE("IDBObjectStore::put");
|
| return put(IDBObjectStoreBackendInterface::AddOrUpdate, IDBAny::create(this), context, value, key, ec);
|
| }
|
|
|
| -PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptExecutionContext* context, ScriptValue& value, PassRefPtr<IDBKey> prpKey, ExceptionCode& ec)
|
| +PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, ExceptionCode& ec)
|
| {
|
| IDB_TRACE("IDBObjectStore::put");
|
| + RefPtr<SerializedScriptValue> value = prpValue;
|
| RefPtr<IDBKey> key = prpKey;
|
| if (m_deleted) {
|
| ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
|
| @@ -157,15 +158,7 @@
|
| ec = IDBDatabaseException::READ_ONLY_ERR;
|
| return 0;
|
| }
|
| -
|
| - ScriptState* state = ScriptState::current();
|
| - RefPtr<SerializedScriptValue> serializedValue = value.serialize(state);
|
| - if (state->hadException()) {
|
| - ec = IDBDatabaseException::IDB_DATA_CLONE_ERR;
|
| - return 0;
|
| - }
|
| -
|
| - if (serializedValue->blobURLs().size() > 0) {
|
| + if (value->blobURLs().size() > 0) {
|
| // FIXME: Add Blob/File/FileList support
|
| ec = IDBDatabaseException::IDB_DATA_CLONE_ERR;
|
| return 0;
|
| @@ -184,7 +177,7 @@
|
| return 0;
|
| }
|
| if (usesInLineKeys) {
|
| - RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(value, keyPath);
|
| + RefPtr<IDBKey> keyPathKey = createIDBKeyFromSerializedValueAndKeyPath(value, keyPath);
|
| if (keyPathKey && !keyPathKey->isValid()) {
|
| ec = IDBDatabaseException::DATA_ERR;
|
| return 0;
|
| @@ -194,7 +187,9 @@
|
| return 0;
|
| }
|
| if (hasKeyGenerator && !keyPathKey) {
|
| - if (!canInjectIDBKeyIntoScriptValue(value, keyPath)) {
|
| + RefPtr<IDBKey> dummyKey = IDBKey::createNumber(-1);
|
| + RefPtr<SerializedScriptValue> valueAfterInjection = injectIDBKeyIntoSerializedValue(dummyKey, value, keyPath);
|
| + if (!valueAfterInjection) {
|
| ec = IDBDatabaseException::DATA_ERR;
|
| return 0;
|
| }
|
| @@ -218,7 +213,7 @@
|
| ASSERT(indexKeys.size() == indexNames.size());
|
|
|
| RefPtr<IDBRequest> request = IDBRequest::create(context, source, m_transaction.get());
|
| - m_backend->putWithIndexKeys(serializedValue.release(), key.release(), putMode, request, m_transaction->backend(), indexNames, indexKeys, ec);
|
| + m_backend->putWithIndexKeys(value.release(), key.release(), putMode, request, m_transaction->backend(), indexNames, indexKeys, ec);
|
| if (ec) {
|
| request->markEarlyDeath();
|
| return 0;
|
| @@ -318,7 +313,7 @@
|
| {
|
| }
|
|
|
| - virtual void handleEvent(ScriptExecutionContext* context, Event* event)
|
| + virtual void handleEvent(ScriptExecutionContext*, Event* event)
|
| {
|
| ASSERT(event->type() == eventNames().successEvent);
|
| EventTarget* target = event->target();
|
| @@ -341,8 +336,7 @@
|
| RefPtr<IDBAny> valueAny = cursor->value();
|
|
|
| ASSERT(valueAny->type() == IDBAny::SerializedScriptValueType);
|
| - RefPtr<SerializedScriptValue> serializedValue = valueAny->serializedScriptValue();
|
| - ScriptValue value(deserializeIDBValue(context, serializedValue));
|
| + RefPtr<SerializedScriptValue> value = valueAny->serializedScriptValue();
|
|
|
| IDBObjectStore::IndexKeys indexKeys;
|
| generateIndexKeysForValue(m_indexMetadata, value, &indexKeys);
|
|
|
| Property changes on: Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
|
| ___________________________________________________________________
|
| Added: svn:mergeinfo
|
| Merged /trunk/WebCore/Modules/indexeddb/IDBObjectStore.cpp:r53455
|
|
|
|
|