WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-90001-20120626140258.patch (text/plain), 12.54 KB, created by
Alec Flett
on 2012-06-26 14:02:58 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alec Flett
Created:
2012-06-26 14:02:58 PDT
Size:
12.54 KB
patch
obsolete
>Subversion Revision: 121239 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c918a948a041e570adf04600cd928a0faeeac0a3..4db0e43c04009c17fadf95b2a9adc24d6b4372cd 100755 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,29 @@ >+2012-06-26 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Hook up render-side key ASSERTing for get() >+ https://bugs.webkit.org/show_bug.cgi?id=90001 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Hook up the new onSuccess and add it to the interface. For now, >+ simply assert that the right value is set. Add the same assertion >+ logic in the value-construction logic when the cursor advances. >+ >+ No new tests, existing tests verify this refactor is correct. >+ >+ * Modules/indexeddb/IDBCallbacks.h: >+ (IDBCallbacks): >+ * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: >+ (WebCore::IDBObjectStoreBackendImpl::getInternal): >+ * Modules/indexeddb/IDBRequest.cpp: >+ (WebCore): >+ (WebCore::IDBRequest::onSuccess): >+ * Modules/indexeddb/IDBRequest.h: >+ * bindings/v8/IDBBindingUtilities.cpp: >+ (WebCore::createIDBKeyFromSerializedValueAndKeyPath): >+ * inspector/InspectorIndexedDBAgent.cpp: >+ (WebCore): >+ > 2012-06-26 Joshua Bell <jsbell@chromium.org> > > IndexedDB: Move method precondition checks to front end objects >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index 8d358983b83f38ba820b8311d2512f3ed6b0b2fd..8e82b47c76d0e73edb984e3a909d409c3e206aab 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,18 @@ >+2012-06-26 Alec Flett <alecflett@chromium.org> >+ >+ IndexedDB: Hook up render-side key ASSERTing for get() >+ https://bugs.webkit.org/show_bug.cgi?id=90001 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Hook up Chromium WebKit API to new onSuccess handler. >+ >+ * src/WebIDBCallbacksImpl.cpp: >+ (WebKit::WebIDBCallbacksImpl::onSuccess): >+ * tests/IDBAbortOnCorruptTest.cpp: >+ (WebCore::MockIDBCallbacks::onSuccess): >+ * tests/IDBDatabaseBackendTest.cpp: >+ > 2012-06-26 Jun Mukai <mukai@chromium.org> > > Allow using <input type="color"> UI in ChromeOS. >diff --git a/Source/WebCore/Modules/indexeddb/IDBCallbacks.h b/Source/WebCore/Modules/indexeddb/IDBCallbacks.h >index 7dee5500f40b6e6434264d9937bd1ad9524d2e2e..0b34b6886d5e1aa43d1953f9ad803a1e2a728924 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCallbacks.h >+++ b/Source/WebCore/Modules/indexeddb/IDBCallbacks.h >@@ -34,6 +34,7 @@ > #include "IDBDatabaseBackendInterface.h" > #include "IDBDatabaseError.h" > #include "IDBKey.h" >+#include "IDBKeyPath.h" > #include "IDBObjectStoreBackendInterface.h" > #include "IDBTransactionBackendInterface.h" > #include "SerializedScriptValue.h" >@@ -55,6 +56,7 @@ public: > virtual void onSuccess(PassRefPtr<IDBKey>) = 0; > virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) = 0; > virtual void onSuccess(PassRefPtr<SerializedScriptValue>) = 0; >+ virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) = 0; > virtual void onSuccessWithContinuation() = 0; > virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >& keys, const Vector<RefPtr<IDBKey> >& primaryKeys, const Vector<RefPtr<SerializedScriptValue> >& values) = 0; > virtual void onBlocked() = 0; >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >index af1c50444735eb94623fcb886a646f04bca65809..b76028661ae7db7b76779b5dc54029c10fe530fb 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >@@ -266,7 +266,24 @@ void IDBCursor::setValueReady() > { > m_currentKey = m_backend->key(); > m_currentPrimaryKey = m_backend->primaryKey(); >- m_currentValue = IDBAny::create(m_backend->value()); >+ >+ RefPtr<SerializedScriptValue> value = m_backend->value(); >+#ifndef NDEBUG >+ if (!isKeyCursor()) { >+ // FIXME: Assert until we can actually inject the right value. >+ RefPtr<IDBObjectStore> objectStore = effectiveObjectStore(); >+ if (objectStore->autoIncrement() && !objectStore->metadata().keyPath.isNull()) { >+ const IDBKeyPath& keyPath = objectStore->metadata().keyPath; >+ if (!keyPath.isNull()) { >+ RefPtr<IDBKey> expectedKey = >+ createIDBKeyFromSerializedValueAndKeyPath(value, keyPath); >+ ASSERT(expectedKey->isEqual(m_currentPrimaryKey.get())); >+ } >+ } >+ } >+#endif >+ m_currentValue = IDBAny::create(value.release()); >+ > m_gotValue = true; > m_valueIsDirty = true; > } >diff --git a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >index af30ef37115a51139c5201b09acbb494272a234b..474cdeb5b5a2c8841a1fcadf98ff62322fdf04dc 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp >@@ -112,6 +112,11 @@ void IDBObjectStoreBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr< > return; > } > >+ if (objectStore->autoIncrement() && !objectStore->keyPath().isNull()) { >+ callbacks->onSuccess(SerializedScriptValue::createFromWire(wireData), >+ key, objectStore->keyPath()); >+ return; >+ } > callbacks->onSuccess(SerializedScriptValue::createFromWire(wireData)); > } > >diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >index 766215bb9c005dae9a3b017f5be97b72b932da14..33922e6a88fe25609b657acd27b9cff42381fd42 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >@@ -35,6 +35,7 @@ > #include "EventListener.h" > #include "EventNames.h" > #include "EventQueue.h" >+#include "IDBBindingUtilities.h" > #include "IDBCursorWithValue.h" > #include "IDBDatabase.h" > #include "IDBEventDispatcher.h" >@@ -304,6 +305,21 @@ void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptVal > enqueueEvent(createSuccessEvent()); > } > >+ >+void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> prpSerializedScriptValue, PassRefPtr<IDBKey> prpPrimaryKey, const IDBKeyPath& keyPath) >+{ >+ LOG_ERROR("CHECKING: onSuccess(value, key, keypath)"); >+ RefPtr<SerializedScriptValue> serializedScriptValue = prpSerializedScriptValue; >+#ifndef NDEBUG >+ // FIXME: Assert until we can actually inject the right value. >+ RefPtr<IDBKey> primaryKey = prpPrimaryKey; >+ RefPtr<IDBKey> expectedKey = >+ createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, keyPath); >+ ASSERT(expectedKey->isEqual(primaryKey.get())); >+#endif >+ onSuccess(serializedScriptValue.release()); >+} >+ > void IDBRequest::onSuccessWithContinuation() > { > IDB_TRACE("IDBRequest::onSuccessWithContinuation"); >diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h >index e104d8f1e815cb5c457f63e13d84943bb2cf9bfd..88a7e60f1e71f851603dcf414324b892e6476f47 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBRequest.h >+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h >@@ -87,6 +87,7 @@ public: > virtual void onSuccess(PassRefPtr<IDBKey>); > virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>); > virtual void onSuccess(PassRefPtr<SerializedScriptValue>); >+ virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&); > virtual void onSuccessWithContinuation(); > virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) { ASSERT_NOT_REACHED(); } // Not implemented. Callback should not reach the renderer side. > virtual void onBlocked(); >diff --git a/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp b/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp >index ee76ee29a001d6cd76c5f17ad35ecb7fcc674c29..661ff01595df05500d7f6cac310e8bc71344b3e8 100644 >--- a/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp >+++ b/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp >@@ -154,13 +154,15 @@ v8::Handle<v8::Value> ensureNthValueOnKeyPath(v8::Handle<v8::Value>& rootValue, > > } // anonymous namespace > >-static PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> value, const String& keyPath) >+static PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> prpValue, const String& keyPath) > { > Vector<String> keyPathElements; > IDBKeyPathParseError error; > IDBParseKeyPath(keyPath, keyPathElements, error); > ASSERT(error == IDBKeyPathParseErrorNone); > >+ RefPtr<SerializedScriptValue> value = prpValue; >+ > V8AuxiliaryContext context; > v8::Handle<v8::Value> v8Value(value->deserialize()); > v8::Handle<v8::Value> v8Key(getNthValueOnKeyPath(v8Value, keyPathElements, keyPathElements.size())); >diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp >index d4ede21a7c509a0b12e2dd221f22712272093128..ffe62c07e8bf53cccec5625a4a5c0e597b3e23e9 100644 >--- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp >+++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp >@@ -112,6 +112,7 @@ public: > virtual void onSuccess(PassRefPtr<IDBKey>) { } > virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) { } > virtual void onSuccess(PassRefPtr<SerializedScriptValue>) { } >+ virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) { } > virtual void onSuccessWithContinuation() { } > virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) { } > virtual void onBlocked() { } >diff --git a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp >index 31266b1a318a241cbb5449f31bd0b964207c7c30..5b5aedf7ccb37e249c53c1af9e8ec8ed9b0e6e12 100644 >--- a/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp >+++ b/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp >@@ -92,9 +92,7 @@ void WebIDBCallbacksImpl::onSuccess(const WebSerializedScriptValue& serializedSc > > void WebIDBCallbacksImpl::onSuccess(const WebSerializedScriptValue& serializedScriptValue, const WebIDBKey& key, const WebIDBKeyPath& keyPath) > { >- // FIXME: proxy to the 3-parameter version when interface lands: >- // m_callbacks->onSuccess(serializedScriptValue, key, keyPath);); >- ASSERT_NOT_REACHED(); >+ m_callbacks->onSuccess(serializedScriptValue, key, keyPath); > } > > void WebIDBCallbacksImpl::onSuccessWithContinuation() >diff --git a/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp b/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp >index 6c78aa53c522b60b20adb67790bd94005b4b7fd2..f53ad50d1d678be26410ed840e3f7a52a776871a 100644 >--- a/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp >+++ b/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp >@@ -57,6 +57,7 @@ public: > virtual void onSuccess(PassRefPtr<IDBKey>) { } > virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) { } > virtual void onSuccess(PassRefPtr<SerializedScriptValue>) { } >+ virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) { } > virtual void onSuccessWithContinuation() { } > virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) { } > virtual void onBlocked() { } >diff --git a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp >index 17dd24bc6c304fdfba88e73b46d838db5d74ddb4..eb3c85abcfd5f95954245f010f46fb71a585d5c8 100644 >--- a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp >+++ b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp >@@ -84,6 +84,7 @@ public: > virtual void onSuccess(PassRefPtr<IDBKey>) OVERRIDE { } > virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) OVERRIDE { } > virtual void onSuccess(PassRefPtr<SerializedScriptValue>) OVERRIDE { } >+ virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) OVERRIDE { }; > virtual void onSuccessWithContinuation() OVERRIDE { } > virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) OVERRIDE { } > virtual void onBlocked() OVERRIDE { }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 90001
:
149603
|
149604
|
149784
|
149786
|
149801