Title: [131661] trunk/Source
Revision
131661
Author
alecfl...@chromium.org
Date
2012-10-17 15:57:30 -0700 (Wed, 17 Oct 2012)

Log Message

IndexedDB: Explicitly send null/undefined/integers to frontend IDBCallbacks
https://bugs.webkit.org/show_bug.cgi?id=99619

Reviewed by Adam Barth.

Source/WebCore:

Rather than pass SerializedScriptValue tokens from the backend,
send explicit null, (as onSuccess(static_cast<SerializedScriptValue*>(0)))
undefined, (as onSucess()), and integers (as onSuccess(long long))

This reduces backend dependency on things that might require a JS
interpreter on the backend.

No new tests, this is a refactor and existing tests cover
correctness. Tests that might fail include:

Test: storage/indexeddb/index-count.html
Test: storage/indexeddb/objectstore-count.html
Test: storage/indexeddb/database-basics.html

* Modules/indexeddb/IDBCallbacks.h:
(IDBCallbacks):
* Modules/indexeddb/IDBCursorBackendImpl.cpp:
(WebCore::IDBCursorBackendImpl::advanceInternal):
(WebCore::IDBCursorBackendImpl::continueFunctionInternal):
(WebCore::IDBCursorBackendImpl::prefetchContinueInternal):
* Modules/indexeddb/IDBCursorBackendImpl.h:
(WebCore::IDBCursorBackendImpl::value):
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::deleteDatabase):
* Modules/indexeddb/IDBIndex.cpp:
* Modules/indexeddb/IDBIndexBackendImpl.cpp:
(WebCore::IDBIndexBackendImpl::openCursorInternal):
(WebCore::IDBIndexBackendImpl::countInternal):
(WebCore::IDBIndexBackendImpl::getInternal):
* Modules/indexeddb/IDBObjectStore.cpp:
* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::getInternal):
(WebCore::IDBObjectStoreBackendImpl::deleteInternal):
(WebCore::IDBObjectStoreBackendImpl::clearInternal):
(WebCore::IDBObjectStoreBackendImpl::openCursorInternal):
(WebCore::IDBObjectStoreBackendImpl::countInternal):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::onSuccess):
(WebCore):
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBTransaction.cpp:
* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
* Modules/indexeddb/IDBTransactionBackendImpl.h:
* Modules/indexeddb/IDBTransactionBackendInterface.h:
* bindings/v8/IDBBindingUtilities.cpp:
(WebCore::deserializeIDBValue):
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore):

Source/WebKit/chromium:

Hook up new undefined/integer-based onSuccess handlers.

* src/IDBCallbacksProxy.cpp:
(WebKit::IDBCallbacksProxy::onSuccess):
(WebKit):
* src/IDBCallbacksProxy.h:
(IDBCallbacksProxy):
* src/WebIDBCallbacksImpl.cpp:
(WebKit::WebIDBCallbacksImpl::onSuccess):
(WebKit):
* src/WebIDBCallbacksImpl.h:
(WebIDBCallbacksImpl):
* tests/IDBAbortOnCorruptTest.cpp:
* tests/IDBDatabaseBackendTest.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131660 => 131661)


--- trunk/Source/WebCore/ChangeLog	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/ChangeLog	2012-10-17 22:57:30 UTC (rev 131661)
@@ -1,3 +1,59 @@
+2012-10-17  Alec Flett  <alecfl...@chromium.org>
+
+        IndexedDB: Explicitly send null/undefined/integers to frontend IDBCallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=99619
+
+        Reviewed by Adam Barth.
+
+        Rather than pass SerializedScriptValue tokens from the backend,
+        send explicit null, (as onSuccess(static_cast<SerializedScriptValue*>(0)))
+        undefined, (as onSucess()), and integers (as onSuccess(long long))
+
+        This reduces backend dependency on things that might require a JS
+        interpreter on the backend.
+
+        No new tests, this is a refactor and existing tests cover
+        correctness. Tests that might fail include:
+
+        Test: storage/indexeddb/index-count.html
+        Test: storage/indexeddb/objectstore-count.html
+        Test: storage/indexeddb/database-basics.html
+
+        * Modules/indexeddb/IDBCallbacks.h:
+        (IDBCallbacks):
+        * Modules/indexeddb/IDBCursorBackendImpl.cpp:
+        (WebCore::IDBCursorBackendImpl::advanceInternal):
+        (WebCore::IDBCursorBackendImpl::continueFunctionInternal):
+        (WebCore::IDBCursorBackendImpl::prefetchContinueInternal):
+        * Modules/indexeddb/IDBCursorBackendImpl.h:
+        (WebCore::IDBCursorBackendImpl::value):
+        * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::deleteDatabase):
+        * Modules/indexeddb/IDBIndex.cpp:
+        * Modules/indexeddb/IDBIndexBackendImpl.cpp:
+        (WebCore::IDBIndexBackendImpl::openCursorInternal):
+        (WebCore::IDBIndexBackendImpl::countInternal):
+        (WebCore::IDBIndexBackendImpl::getInternal):
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::getInternal):
+        (WebCore::IDBObjectStoreBackendImpl::deleteInternal):
+        (WebCore::IDBObjectStoreBackendImpl::clearInternal):
+        (WebCore::IDBObjectStoreBackendImpl::openCursorInternal):
+        (WebCore::IDBObjectStoreBackendImpl::countInternal):
+        * Modules/indexeddb/IDBRequest.cpp:
+        (WebCore::IDBRequest::onSuccess):
+        (WebCore):
+        * Modules/indexeddb/IDBRequest.h:
+        * Modules/indexeddb/IDBTransaction.cpp:
+        * Modules/indexeddb/IDBTransactionBackendImpl.cpp:
+        * Modules/indexeddb/IDBTransactionBackendImpl.h:
+        * Modules/indexeddb/IDBTransactionBackendInterface.h:
+        * bindings/v8/IDBBindingUtilities.cpp:
+        (WebCore::deserializeIDBValue):
+        * inspector/InspectorIndexedDBAgent.cpp:
+        (WebCore):
+
 2012-10-17  Nate Chapin  <jap...@chromium.org>
 
         Move ResourceRequest construction out of SubresourceLoader

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCallbacks.h (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCallbacks.h	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCallbacks.h	2012-10-17 22:57:30 UTC (rev 131661)
@@ -62,6 +62,12 @@
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>) = 0;
     // From IDBObjectStore/IDBIndex.get() (with key injection)
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) = 0;
+    // From IDBObjectStore/IDBIndex.count()
+    virtual void onSuccess(int64_t value) = 0;
+
+    // From IDBFactor.deleteDatabase(), IDBObjectStore/IDBIndex.get(), IDBObjectStore.delete(), IDBObjectStore.clear()
+    virtual void onSuccess() = 0;
+    
     // From IDBCursor.advance()/continue()
     virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>) = 0;
     // From IDBCursor.advance()/continue()

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -87,7 +87,7 @@
     RefPtr<IDBCursorBackendImpl> cursor = prpCursor;
     if (!cursor->m_cursor || !cursor->m_cursor->advance(count)) {
         cursor->m_cursor = 0;
-        callbacks->onSuccess(SerializedScriptValue::nullValue());
+        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
@@ -102,7 +102,7 @@
 
     if (!cursor->m_cursor || !cursor->m_cursor->continueFunction(key.get())) {
         cursor->m_cursor = 0;
-        callbacks->onSuccess(SerializedScriptValue::nullValue());
+        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
@@ -169,7 +169,7 @@
     }
 
     if (!foundKeys.size()) {
-        callbacks->onSuccess(SerializedScriptValue::nullValue());
+        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.h	2012-10-17 22:57:30 UTC (rev 131661)
@@ -67,7 +67,7 @@
 
     PassRefPtr<IDBKey> key() const { return m_cursor->key(); }
     PassRefPtr<IDBKey> primaryKey() const { return m_cursor->primaryKey(); }
-    PassRefPtr<SerializedScriptValue> value() const { return (m_cursorType == IndexKeyCursor) ? SerializedScriptValue::nullValue() : SerializedScriptValue::createFromWire(m_cursor->value()); }
+    PassRefPtr<SerializedScriptValue> value() const { return (m_cursorType == IndexKeyCursor) ? 0 : SerializedScriptValue::createFromWire(m_cursor->value()); }
     void close();
 
 private:

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -561,7 +561,7 @@
     m_id = InvalidId;
     m_intVersion = IDBDatabaseMetadata::NoIntVersion;
     m_objectStores.clear();
-    callbacks->onSuccess(SerializedScriptValue::undefinedValue());
+    callbacks->onSuccess();
 }
 
 void IDBDatabaseBackendImpl::close(PassRefPtr<IDBDatabaseCallbacks> prpCallbacks)

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -37,6 +37,7 @@
 #include "IDBRequest.h"
 #include "IDBTracing.h"
 #include "IDBTransaction.h"
+#include "ScriptExecutionContext.h"
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndexBackendImpl.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -84,7 +84,7 @@
     }
 
     if (!backingStoreCursor) {
-        callbacks->onSuccess(SerializedScriptValue::nullValue());
+        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
@@ -123,7 +123,7 @@
 
     RefPtr<IDBBackingStore::Cursor> backingStoreCursor = index->backingStore()->openIndexKeyCursor(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), range.get(), IDBCursor::NEXT);
     if (!backingStoreCursor) {
-        callbacks->onSuccess(SerializedScriptValue::numberValue(count));
+        callbacks->onSuccess(count);
         return;
     }
 
@@ -131,7 +131,7 @@
         ++count;
     } while (backingStoreCursor->continueFunction(0));
     backingStoreCursor->close();
-    callbacks->onSuccess(SerializedScriptValue::numberValue(count));
+    callbacks->onSuccess(count);
 }
 
 void IDBIndexBackendImpl::count(PassRefPtr<IDBKeyRange> range, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -155,7 +155,7 @@
         RefPtr<IDBBackingStore::Cursor> backingStoreCursor = index->backingStore()->openIndexCursor(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), index->id(), keyRange.get(), IDBCursor::NEXT);
 
         if (!backingStoreCursor) {
-            callbacks->onSuccess(SerializedScriptValue::undefinedValue());
+            callbacks->onSuccess();
             return;
         }
         key = backingStoreCursor->key();
@@ -167,7 +167,7 @@
     String value = index->backingStore()->getObjectStoreRecord(transaction->backingStoreTransaction(), index->databaseId(), index->m_objectStoreBackend->id(), *primaryKey);
 
     if (value.isNull()) {
-        callbacks->onSuccess(SerializedScriptValue::undefinedValue());
+        callbacks->onSuccess();
         return;
     }
     if (index->m_objectStoreBackend->autoIncrement() && !index->m_objectStoreBackend->keyPath().isNull()) {

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -41,6 +41,7 @@
 #include "IDBKeyRange.h"
 #include "IDBTracing.h"
 #include "IDBTransaction.h"
+#include "ScriptExecutionContext.h"
 #include "SerializedScriptValue.h"
 #include <wtf/UnusedParam.h>
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -42,7 +42,6 @@
 #include "IDBKeyRange.h"
 #include "IDBTracing.h"
 #include "IDBTransactionBackendImpl.h"
-#include "ScriptExecutionContext.h"
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
@@ -91,7 +90,7 @@
     else {
         RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->backingStore()->openObjectStoreCursor(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), keyRange.get(), IDBCursor::NEXT);
         if (!backingStoreCursor) {
-            callbacks->onSuccess(SerializedScriptValue::undefinedValue());
+            callbacks->onSuccess();
             return;
         }
         key = backingStoreCursor->key();
@@ -100,7 +99,7 @@
 
     String wireData = objectStore->backingStore()->getObjectStoreRecord(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), *key);
     if (wireData.isNull()) {
-        callbacks->onSuccess(SerializedScriptValue::undefinedValue());
+        callbacks->onSuccess();
         return;
     }
 
@@ -404,7 +403,7 @@
         backingStoreCursor->close();
     }
 
-    callbacks->onSuccess(SerializedScriptValue::undefinedValue());
+    callbacks->onSuccess();
 }
 
 void IDBObjectStoreBackendImpl::clear(PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transactionPtr, ExceptionCode&)
@@ -425,7 +424,7 @@
 void IDBObjectStoreBackendImpl::clearInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendImpl> transaction)
 {
     objectStore->backingStore()->clearObjectStore(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id());
-    callbacks->onSuccess(SerializedScriptValue::undefinedValue());
+    callbacks->onSuccess();
 }
 
 PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendImpl::createIndex(int64_t id, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
@@ -521,7 +520,7 @@
     if (taskType == IDBTransactionBackendInterface::PreemptiveTask)
         transaction->addPreemptiveEvent();
     if (!backingStoreCursor) {
-        callbacks->onSuccess(SerializedScriptValue::nullValue());
+        callbacks->onSuccess(static_cast<SerializedScriptValue*>(0));
         return;
     }
 
@@ -544,7 +543,7 @@
     uint32_t count = 0;
     RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->backingStore()->openObjectStoreKeyCursor(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), range.get(), IDBCursor::NEXT);
     if (!backingStoreCursor) {
-        callbacks->onSuccess(SerializedScriptValue::numberValue(count));
+        callbacks->onSuccess(count);
         return;
     }
 
@@ -553,7 +552,7 @@
     } while (backingStoreCursor->continueFunction(0));
 
     backingStoreCursor->close();
-    callbacks->onSuccess(SerializedScriptValue::numberValue(count));
+    callbacks->onSuccess(count);
 }
 
 void IDBObjectStoreBackendImpl::loadIndexes()

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -41,6 +41,7 @@
 #include "IDBEventDispatcher.h"
 #include "IDBTracing.h"
 #include "IDBTransaction.h"
+#include "ScriptExecutionContext.h"
 
 namespace WebCore {
 
@@ -376,6 +377,16 @@
     onSuccessInternal(value);
 }
 
+void IDBRequest::onSuccess(int64_t value)
+{
+    return onSuccess(SerializedScriptValue::numberValue(value));
+}
+
+void IDBRequest::onSuccess()
+{
+    return onSuccess(SerializedScriptValue::undefinedValue());
+}
+
 void IDBRequest::onSuccessInternal(const ScriptValue& value)
 {
     m_result = IDBAny::create(value);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h	2012-10-17 22:57:30 UTC (rev 131661)
@@ -88,6 +88,8 @@
     virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>);
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>);
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&);
+    virtual void onSuccess(int64_t);
+    virtual void onSuccess();
     virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue>);
     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.
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -40,6 +40,7 @@
 #include "IDBPendingTransactionMonitor.h"
 #include "IDBTracing.h"
 #include "ScriptCallStack.h"
+#include "ScriptExecutionContext.h"
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -35,6 +35,7 @@
 #include "IDBObjectStoreBackendImpl.h"
 #include "IDBTracing.h"
 #include "IDBTransactionCoordinator.h"
+#include "ScriptExecutionContext.h"
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h	2012-10-17 22:57:30 UTC (rev 131661)
@@ -33,6 +33,7 @@
 #include "IDBDatabaseError.h"
 #include "IDBTransactionBackendInterface.h"
 #include "IDBTransactionCallbacks.h"
+#include "ScriptExecutionContext.h"
 #include "Timer.h"
 #include <wtf/Deque.h>
 #include <wtf/HashSet.h>

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h (131660 => 131661)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h	2012-10-17 22:57:30 UTC (rev 131661)
@@ -27,7 +27,6 @@
 #define IDBTransactionBackendInterface_h
 
 #include "IDBCallbacks.h"
-#include "ScriptExecutionContext.h"
 #include <wtf/Threading.h>
 #include <wtf/text/WTFString.h>
 

Modified: trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp (131660 => 131661)


--- trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -214,7 +214,10 @@
 {
     v8::HandleScope handleScope;
     v8::Context::Scope contextScope(toV8Context(scriptContext, UseCurrentWorld));
-    return ScriptValue(prpValue->deserialize());
+    RefPtr<SerializedScriptValue> serializedValue = prpValue;
+    if (serializedValue)
+        return ScriptValue(serializedValue->deserialize());
+    return ScriptValue(v8::Null());
 }
 
 bool injectIDBKeyIntoScriptValue(PassRefPtr<IDBKey> key, ScriptValue& value, const IDBKeyPath& keyPath)

Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (131660 => 131661)


--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -102,6 +102,8 @@
     virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) OVERRIDE { }
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>) OVERRIDE { }
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) OVERRIDE { }
+    virtual void onSuccess(int64_t value) OVERRIDE { return onSuccess(SerializedScriptValue::numberValue(value)); }
+    virtual void onSuccess() OVERRIDE { return onSuccess(SerializedScriptValue::undefinedValue()); }
     virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>) OVERRIDE { }
     virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) OVERRIDE { }
     virtual void onUpgradeNeeded(int64_t, PassRefPtr<WebCore::IDBTransactionBackendInterface>, PassRefPtr<WebCore::IDBDatabaseBackendInterface>) OVERRIDE { }

Modified: trunk/Source/WebKit/chromium/ChangeLog (131660 => 131661)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-10-17 22:57:30 UTC (rev 131661)
@@ -1,3 +1,25 @@
+2012-10-17  Alec Flett  <alecfl...@chromium.org>
+
+        IndexedDB: Explicitly send null/undefined/integers to frontend IDBCallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=99619
+
+        Reviewed by Adam Barth.
+
+        Hook up new undefined/integer-based onSuccess handlers.
+
+        * src/IDBCallbacksProxy.cpp:
+        (WebKit::IDBCallbacksProxy::onSuccess):
+        (WebKit):
+        * src/IDBCallbacksProxy.h:
+        (IDBCallbacksProxy):
+        * src/WebIDBCallbacksImpl.cpp:
+        (WebKit::WebIDBCallbacksImpl::onSuccess):
+        (WebKit):
+        * src/WebIDBCallbacksImpl.h:
+        (WebIDBCallbacksImpl):
+        * tests/IDBAbortOnCorruptTest.cpp:
+        * tests/IDBDatabaseBackendTest.cpp:
+
 2012-10-17  Sadrul Habib Chowdhury  <sad...@chromium.org>
 
         plugins: Allow a plugin to dictate whether it can receive drag events or not.

Modified: trunk/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp (131660 => 131661)


--- trunk/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebKit/chromium/src/IDBCallbacksProxy.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -106,6 +106,16 @@
     m_callbacks->onSuccess(serializedScriptValue, key, keyPath);
 }
 
+void IDBCallbacksProxy::onSuccess(int64_t value)
+{
+    m_callbacks->onSuccess(value);
+}
+
+void IDBCallbacksProxy::onSuccess()
+{
+    m_callbacks->onSuccess();
+}
+
 void IDBCallbacksProxy::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SerializedScriptValue> value)
 {
     m_callbacks->onSuccess(key, primaryKey, value);

Modified: trunk/Source/WebKit/chromium/src/IDBCallbacksProxy.h (131660 => 131661)


--- trunk/Source/WebKit/chromium/src/IDBCallbacksProxy.h	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebKit/chromium/src/IDBCallbacksProxy.h	2012-10-17 22:57:30 UTC (rev 131661)
@@ -54,6 +54,8 @@
     virtual void onSuccess(PassRefPtr<WebCore::IDBTransactionBackendInterface>);
     virtual void onSuccess(PassRefPtr<WebCore::SerializedScriptValue>);
     virtual void onSuccess(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, const WebCore::IDBKeyPath&);
+    virtual void onSuccess(int64_t);
+    virtual void onSuccess();
     virtual void onSuccess(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBKey> primaryKey, PassRefPtr<WebCore::SerializedScriptValue>);
     virtual void onSuccessWithPrefetch(const Vector<RefPtr<WebCore::IDBKey> >& keys, const Vector<RefPtr<WebCore::IDBKey> >& primaryKeys, const Vector<RefPtr<WebCore::SerializedScriptValue> >& values);
     virtual void onBlocked();

Modified: trunk/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp (131660 => 131661)


--- trunk/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebKit/chromium/src/WebIDBCallbacksImpl.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -100,6 +100,16 @@
     m_callbacks->onSuccess(serializedScriptValue, key, keyPath);
 }
 
+void WebIDBCallbacksImpl::onSuccess(long long value)
+{
+    m_callbacks->onSuccess(value);
+}
+
+void WebIDBCallbacksImpl::onSuccess()
+{
+    m_callbacks->onSuccess();
+}
+
 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& primaryKey, const WebSerializedScriptValue& value)
 {
     m_callbacks->onSuccess(key, primaryKey, value);

Modified: trunk/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h (131660 => 131661)


--- trunk/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebKit/chromium/src/WebIDBCallbacksImpl.h	2012-10-17 22:57:30 UTC (rev 131661)
@@ -50,6 +50,8 @@
     virtual void onSuccess(const WebSerializedScriptValue&);
     virtual void onSuccess(const WebSerializedScriptValue&, const WebIDBKey&, const WebIDBKeyPath&);
     virtual void onSuccess(const WebIDBKey&, const WebIDBKey& primaryKey, const WebSerializedScriptValue&);
+    virtual void onSuccess(long long);
+    virtual void onSuccess();
     virtual void onBlocked();
     virtual void onBlocked(long long oldVersion);
     virtual void onUpgradeNeeded(long long oldVersion, WebIDBTransaction*, WebIDBDatabase*);

Modified: trunk/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp (131660 => 131661)


--- trunk/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebKit/chromium/tests/IDBAbortOnCorruptTest.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -61,6 +61,8 @@
     virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) { }
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>) { }
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) { }
+    virtual void onSuccess(int64_t) OVERRIDE { }
+    virtual void onSuccess() OVERRIDE { }
     virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>) { };
     virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) { }
     virtual void onBlocked() { }

Modified: trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp (131660 => 131661)


--- trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp	2012-10-17 22:55:33 UTC (rev 131660)
+++ trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp	2012-10-17 22:57:30 UTC (rev 131661)
@@ -91,6 +91,8 @@
     virtual void onSuccess(PassRefPtr<IDBTransactionBackendInterface>) OVERRIDE { }
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>) OVERRIDE { }
     virtual void onSuccess(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, const IDBKeyPath&) OVERRIDE { };
+    virtual void onSuccess(int64_t) OVERRIDE { }
+    virtual void onSuccess() OVERRIDE { }
     virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>) OVERRIDE { };
     virtual void onSuccessWithPrefetch(const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<IDBKey> >&, const Vector<RefPtr<SerializedScriptValue> >&) OVERRIDE { }
     virtual void onBlocked() OVERRIDE { }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to