Title: [135471] trunk/Source/WebCore
Revision
135471
Author
[email protected]
Date
2012-11-21 20:34:40 -0800 (Wed, 21 Nov 2012)

Log Message

IndexedDB: Obtain ScriptState from IDL binding generator
https://bugs.webkit.org/show_bug.cgi?id=102552

Patch by Michael Pruett <[email protected]> on 2012-11-21
Reviewed by Kentaro Hara.

Obtain ScriptState from IDL binding generator rather than directly
calling ScriptState::current() since that method does not exist
in JSC.

Tests: storage/indexeddb/*

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::update):
* Modules/indexeddb/IDBCursor.h:
(IDBCursor):
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::add):
(WebCore::IDBObjectStore::put):
* Modules/indexeddb/IDBObjectStore.h:
(WebCore::IDBObjectStore::add):
(WebCore::IDBObjectStore::put):
(IDBObjectStore):
* Modules/indexeddb/IDBObjectStore.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135470 => 135471)


--- trunk/Source/WebCore/ChangeLog	2012-11-22 04:30:52 UTC (rev 135470)
+++ trunk/Source/WebCore/ChangeLog	2012-11-22 04:34:40 UTC (rev 135471)
@@ -1,3 +1,30 @@
+2012-11-21  Michael Pruett  <[email protected]>
+
+        IndexedDB: Obtain ScriptState from IDL binding generator
+        https://bugs.webkit.org/show_bug.cgi?id=102552
+
+        Reviewed by Kentaro Hara.
+
+        Obtain ScriptState from IDL binding generator rather than directly
+        calling ScriptState::current() since that method does not exist
+        in JSC.
+
+        Tests: storage/indexeddb/*
+
+        * Modules/indexeddb/IDBCursor.cpp:
+        (WebCore::IDBCursor::update):
+        * Modules/indexeddb/IDBCursor.h:
+        (IDBCursor):
+        * Modules/indexeddb/IDBCursor.idl:
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::add):
+        (WebCore::IDBObjectStore::put):
+        * Modules/indexeddb/IDBObjectStore.h:
+        (WebCore::IDBObjectStore::add):
+        (WebCore::IDBObjectStore::put):
+        (IDBObjectStore):
+        * Modules/indexeddb/IDBObjectStore.idl:
+
 2012-11-21  Filip Pizlo  <[email protected]>
 
         Rename dataLog() and dataLogV() to dataLogF() and dataLogFV()

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (135470 => 135471)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp	2012-11-22 04:30:52 UTC (rev 135470)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp	2012-11-22 04:34:40 UTC (rev 135471)
@@ -124,7 +124,7 @@
     return m_source.get();
 }
 
-PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, ScriptValue& value, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionCode& ec)
 {
     IDB_TRACE("IDBCursor::update");
 
@@ -152,7 +152,7 @@
         }
     }
 
-    return objectStore->put(IDBObjectStoreBackendInterface::CursorUpdate, IDBAny::create(this), context, value, m_currentPrimaryKey, ec);
+    return objectStore->put(IDBObjectStoreBackendInterface::CursorUpdate, IDBAny::create(this), state, value, m_currentPrimaryKey, ec);
 }
 
 void IDBCursor::advance(long long count, ExceptionCode& ec)

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h (135470 => 135471)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h	2012-11-22 04:30:52 UTC (rev 135470)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h	2012-11-22 04:34:40 UTC (rev 135471)
@@ -77,7 +77,7 @@
     const ScriptValue& value() const;
     IDBAny* source() const;
 
-    PassRefPtr<IDBRequest> update(ScriptExecutionContext*, ScriptValue&, ExceptionCode&);
+    PassRefPtr<IDBRequest> update(ScriptState*, ScriptValue&, ExceptionCode&);
     // FIXME: Make this unsigned long once webkit.org/b/96798 lands.
     void advance(long long, ExceptionCode&);
     void continueFunction(PassRefPtr<IDBKey>, ExceptionCode&);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl (135470 => 135471)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl	2012-11-22 04:30:52 UTC (rev 135470)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl	2012-11-22 04:34:40 UTC (rev 135471)
@@ -33,7 +33,7 @@
     readonly attribute any primaryKey;
     readonly attribute IDBAny source;
 
-    [CallWith=ScriptExecutionContext] IDBRequest update(in any value)
+    [CallWith=ScriptState] IDBRequest update(in any value)
         raises (DOMException);
     // FIXME: Make this [EnforceRange] unsigned long once webkit.org/b/96798 lands.
     void advance(in long long count)

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (135470 => 135471)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-11-22 04:30:52 UTC (rev 135470)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-11-22 04:34:40 UTC (rev 135471)
@@ -124,19 +124,19 @@
     }
 }
 
-PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, ScriptValue& value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptState* state, ScriptValue& value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::add");
-    return put(IDBObjectStoreBackendInterface::AddOnly, IDBAny::create(this), context, value, key, ec);
+    return put(IDBObjectStoreBackendInterface::AddOnly, IDBAny::create(this), state, value, key, ec);
 }
 
-PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, ScriptValue& value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptState* state, ScriptValue& value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::put");
-    return put(IDBObjectStoreBackendInterface::AddOrUpdate, IDBAny::create(this), context, value, key, ec);
+    return put(IDBObjectStoreBackendInterface::AddOrUpdate, IDBAny::create(this), state, 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, ScriptState* state, ScriptValue& value, PassRefPtr<IDBKey> prpKey, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::put");
     RefPtr<IDBKey> key = prpKey;
@@ -153,7 +153,6 @@
         return 0;
     }
 
-    ScriptState* state = ScriptState::current();
     RefPtr<SerializedScriptValue> serializedValue = value.serialize(state);
     if (state->hadException()) {
         ec = IDBDatabaseException::IDB_DATA_CLONE_ERR;
@@ -169,6 +168,8 @@
     const IDBKeyPath& keyPath = m_metadata.keyPath;
     const bool usesInLineKeys = !keyPath.isNull();
     const bool hasKeyGenerator = autoIncrement();
+
+    ScriptExecutionContext* context = scriptExecutionContextFromScriptState(state);
     DOMRequestState requestState(context);
 
     if (putMode != IDBObjectStoreBackendInterface::CursorUpdate && usesInLineKeys && key) {

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (135470 => 135471)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2012-11-22 04:30:52 UTC (rev 135470)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2012-11-22 04:34:40 UTC (rev 135471)
@@ -65,8 +65,8 @@
     PassRefPtr<IDBTransaction> transaction() const { return m_transaction; }
     bool autoIncrement() const { return m_metadata.autoIncrement; }
 
-    PassRefPtr<IDBRequest> add(ScriptExecutionContext* context, ScriptValue& value, ExceptionCode& ec) { return add(context, value, 0, ec);  }
-    PassRefPtr<IDBRequest> put(ScriptExecutionContext* context, ScriptValue& value, ExceptionCode& ec) { return put(context, value, 0, ec);  }
+    PassRefPtr<IDBRequest> add(ScriptState* state, ScriptValue& value, ExceptionCode& ec) { return add(state, value, 0, ec);  }
+    PassRefPtr<IDBRequest> put(ScriptState* state, ScriptValue& value, ExceptionCode& ec) { return put(state, value, 0, ec);  }
     PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, static_cast<IDBKeyRange*>(0), ec); }
     PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::directionNext(), ec); }
     PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec) { return openCursor(context, key, IDBCursor::directionNext(), ec); }
@@ -76,8 +76,8 @@
 
     PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
     PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&);
-    PassRefPtr<IDBRequest> add(ScriptExecutionContext*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
-    PassRefPtr<IDBRequest> put(ScriptExecutionContext*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
+    PassRefPtr<IDBRequest> add(ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
+    PassRefPtr<IDBRequest> put(ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
     PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&);
     PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<IDBKey> key, ExceptionCode&);
     PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&);
@@ -93,7 +93,7 @@
     PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&);
     PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
 
-    PassRefPtr<IDBRequest> put(IDBObjectStoreBackendInterface::PutMode, PassRefPtr<IDBAny> source, ScriptExecutionContext*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
+    PassRefPtr<IDBRequest> put(IDBObjectStoreBackendInterface::PutMode, PassRefPtr<IDBAny> source, ScriptState*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
     void markDeleted() { m_deleted = true; }
     void transactionFinished();
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (135470 => 135471)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2012-11-22 04:30:52 UTC (rev 135470)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2012-11-22 04:34:40 UTC (rev 135471)
@@ -33,9 +33,9 @@
     readonly attribute IDBTransaction transaction;
     readonly attribute boolean autoIncrement;
 
-    [CallWith=ScriptExecutionContext] IDBRequest put(in any value, in [Optional] IDBKey key)
+    [CallWith=ScriptState] IDBRequest put(in any value, in [Optional] IDBKey key)
         raises (DOMException);
-    [CallWith=ScriptExecutionContext] IDBRequest add(in any value, in [Optional] IDBKey key)
+    [CallWith=ScriptState] IDBRequest add(in any value, in [Optional] IDBKey key)
         raises (DOMException);
     [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction] IDBRequest delete(in IDBKeyRange? keyRange)
         raises (DOMException);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to