| Index: Source/WebCore/Modules/indexeddb/IDBRequest.cpp
|
| ===================================================================
|
| --- Source/WebCore/Modules/indexeddb/IDBRequest.cpp (revision 132816)
|
| +++ Source/WebCore/Modules/indexeddb/IDBRequest.cpp (working copy)
|
| @@ -214,7 +214,7 @@
|
| return 0;
|
| }
|
|
|
| -void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, const ScriptValue& value)
|
| +void IDBRequest::setResultCursor(PassRefPtr<IDBCursor> cursor, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value)
|
| {
|
| ASSERT(m_readyState == PENDING);
|
| m_cursorKey = key;
|
| @@ -276,13 +276,12 @@
|
| enqueueEvent(createSuccessEvent());
|
| }
|
|
|
| -void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> serializedValue)
|
| +void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackendInterface> backend, PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value)
|
| {
|
| IDB_TRACE("IDBRequest::onSuccess(IDBCursor)");
|
| if (!shouldEnqueueEvent())
|
| return;
|
|
|
| - ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedValue);
|
| ASSERT(m_cursorType != IDBCursorBackendInterface::InvalidCursorType);
|
| RefPtr<IDBCursor> cursor;
|
| if (m_cursorType == IDBCursorBackendInterface::IndexKeyCursor)
|
| @@ -303,7 +302,7 @@
|
| if (idbKey && idbKey->isValid())
|
| m_result = IDBAny::create(idbKey);
|
| else
|
| - m_result = IDBAny::createInvalid();
|
| + m_result = IDBAny::create(SerializedScriptValue::undefinedValue());
|
| enqueueEvent(createSuccessEvent());
|
| }
|
|
|
| @@ -338,8 +337,9 @@
|
| if (!shouldEnqueueEvent())
|
| return;
|
|
|
| - ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedScriptValue);
|
| - onSuccessInternal(value);
|
| + m_result = IDBAny::create(serializedScriptValue);
|
| + m_pendingCursor.clear();
|
| + enqueueEvent(createSuccessEvent());
|
| }
|
|
|
| #ifndef NDEBUG
|
| @@ -364,32 +364,30 @@
|
| #ifndef NDEBUG
|
| ASSERT(keyPath == effectiveObjectStore(m_source)->keyPath());
|
| #endif
|
| - ScriptValue value = deserializeIDBValue(scriptExecutionContext(), prpSerializedScriptValue);
|
| + RefPtr<SerializedScriptValue> value = prpSerializedScriptValue;
|
|
|
| RefPtr<IDBKey> primaryKey = prpPrimaryKey;
|
| #ifndef NDEBUG
|
| - RefPtr<IDBKey> expectedKey = createIDBKeyFromScriptValueAndKeyPath(value, keyPath);
|
| + RefPtr<IDBKey> expectedKey = createIDBKeyFromSerializedValueAndKeyPath(value, keyPath);
|
| ASSERT(!expectedKey || expectedKey->isEqual(primaryKey.get()));
|
| #endif
|
| - bool injected = injectIDBKeyIntoScriptValue(primaryKey, value, keyPath);
|
| - ASSERT_UNUSED(injected, injected);
|
| - onSuccessInternal(value);
|
| + RefPtr<SerializedScriptValue> valueAfterInjection = injectIDBKeyIntoSerializedValue(primaryKey, value, keyPath);
|
| + ASSERT(valueAfterInjection);
|
| + if (!valueAfterInjection) {
|
| + // Checks in put() ensure this should only happen if I/O error occurs.
|
| + onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error inserting generated key into the object."));
|
| + return;
|
| + }
|
| + value = valueAfterInjection;
|
| + onSuccess(value.release());
|
| }
|
|
|
| -void IDBRequest::onSuccessInternal(const ScriptValue& value)
|
| +void IDBRequest::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value)
|
| {
|
| - m_result = IDBAny::create(value);
|
| - m_pendingCursor.clear();
|
| - enqueueEvent(createSuccessEvent());
|
| -}
|
| -
|
| -void IDBRequest::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> serializedValue)
|
| -{
|
| IDB_TRACE("IDBRequest::onSuccess(key, primaryKey, value)");
|
| if (!shouldEnqueueEvent())
|
| return;
|
|
|
| - ScriptValue value = deserializeIDBValue(scriptExecutionContext(), serializedValue);
|
| ASSERT(m_pendingCursor);
|
| setResultCursor(m_pendingCursor.release(), key, primaryKey, value);
|
| enqueueEvent(createSuccessEvent());
|
| @@ -458,7 +456,7 @@
|
| if (event->type() == eventNames().successEvent) {
|
| cursorToNotify = getResultCursor();
|
| if (cursorToNotify)
|
| - cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimaryKey.release(), m_cursorValue);
|
| + cursorToNotify->setValueReady(m_cursorKey.release(), m_cursorPrimaryKey.release(), m_cursorValue.release());
|
| }
|
|
|
| if (event->type() == eventNames().upgradeneededEvent) {
|
|
|