Diff
Modified: trunk/Source/WebCore/ChangeLog (199309 => 199310)
--- trunk/Source/WebCore/ChangeLog 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/ChangeLog 2016-04-11 21:31:53 UTC (rev 199310)
@@ -1,3 +1,89 @@
+2016-04-11 Brady Eidson <[email protected]>
+
+ Clean up IDBBindingUtilities.
+ https://bugs.webkit.org/show_bug.cgi?id=156472
+
+ Reviewed by Alex Christensen.
+
+ No new tests (No change in behavior).
+
+ - Get rid of a whole bunch of unused functions (since we got rid of Legacy IDB).
+ - Make more functions deal in ExecState/ScriptExecutionContexts instead of DOMRequestState.
+ - Make more functions deal in JSValue instead of Deprecated::ScriptValue.
+
+ * bindings/scripts/IDLAttributes.txt: Add a new attribute to signify that an implementation returns
+ JSValues instead of Deprecated::ScriptState
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (NativeToJSValue): Use that new attribute.
+
+ * Modules/indexeddb/IDBAny.cpp:
+ (WebCore::IDBAny::IDBAny):
+ (WebCore::IDBAny::scriptValue):
+ * Modules/indexeddb/IDBAny.h:
+ (WebCore::IDBAny::create):
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::key):
+ (WebCore::IDBCursor::primaryKey):
+ (WebCore::IDBCursor::value):
+ (WebCore::IDBCursor::update):
+ (WebCore::IDBCursor::continueFunction):
+ (WebCore::IDBCursor::deleteFunction):
+ (WebCore::IDBCursor::setGetResult):
+ * Modules/indexeddb/IDBCursor.h:
+ * Modules/indexeddb/IDBCursor.idl:
+ * Modules/indexeddb/IDBCursorWithValue.idl:
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::IDBFactory::cmp):
+ * Modules/indexeddb/IDBIndex.cpp:
+ (WebCore::IDBIndex::count):
+ (WebCore::IDBIndex::get):
+ (WebCore::IDBIndex::getKey):
+ * Modules/indexeddb/IDBKeyRange.cpp:
+ (WebCore::IDBKeyRange::lowerValue):
+ (WebCore::IDBKeyRange::upperValue):
+ (WebCore::IDBKeyRange::only):
+ (WebCore::IDBKeyRange::lowerBound):
+ (WebCore::IDBKeyRange::upperBound):
+ (WebCore::IDBKeyRange::bound):
+ * Modules/indexeddb/IDBKeyRange.h:
+ * Modules/indexeddb/IDBKeyRange.idl:
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::get):
+ (WebCore::IDBObjectStore::modernDelete):
+ (WebCore::IDBObjectStore::count):
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::setResult):
+ (WebCore::IDBRequest::setResultToStructuredClone):
+ * Modules/indexeddb/server/MemoryObjectStore.cpp:
+ (WebCore::IDBServer::MemoryObjectStore::updateIndexesForPutRecord):
+ (WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords):
+ * bindings/js/IDBBindingUtilities.cpp:
+ (WebCore::idbKeyPathFromValue):
+ (WebCore::deserializeIDBValueDataToJSValue):
+ (WebCore::scriptValueToIDBKey):
+ (WebCore::idbKeyDataToScriptValue):
+ (WebCore::idbKeyDataToJSValue): Deleted.
+ (WebCore::injectIDBKeyIntoScriptValue): Deleted.
+ (WebCore::createIDBKeyFromScriptValueAndKeyPath): Deleted.
+ (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath): Deleted.
+ (WebCore::canInjectIDBKeyIntoScriptValue): Deleted.
+ (WebCore::deserializeIDBValue): Deleted.
+ (WebCore::deserializeIDBValueData): Deleted.
+ (WebCore::deserializeIDBValueBuffer): Deleted.
+ (WebCore::idbValueDataToJSValue): Deleted.
+ (WebCore::idbKeyToScriptValue): Deleted.
+ * bindings/js/IDBBindingUtilities.h:
+ * bindings/js/JSIDBAnyCustom.cpp:
+ (WebCore::toJS):
+ * bindings/js/JSIDBDatabaseCustom.cpp:
+ (WebCore::JSIDBDatabase::createObjectStore):
+ * bindings/js/JSIDBObjectStoreCustom.cpp:
+ (WebCore::JSIDBObjectStore::createIndex):
+ * dom/ScriptExecutionContext.cpp:
+ (WebCore::ScriptExecutionContext::execState):
+ * dom/ScriptExecutionContext.h:
+ * inspector/InspectorIndexedDBAgent.cpp:
+
2016-04-09 Gavin Barraclough <[email protected]>
WebKit should adopt journal_mode=wal for all SQLite databases.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBAny.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -78,7 +78,7 @@
{
}
-IDBAny::IDBAny(const Deprecated::ScriptValue& value)
+IDBAny::IDBAny(const JSC::JSValue& value)
: m_type(IDBAny::Type::ScriptValue)
, m_scriptValue(value)
{
@@ -133,7 +133,7 @@
return nullptr;
}
-const Deprecated::ScriptValue& IDBAny::scriptValue()
+JSC::JSValue IDBAny::scriptValue()
{
return m_scriptValue;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBAny.h (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBAny.h 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBAny.h 2016-04-11 21:31:53 UTC (rev 199310)
@@ -29,7 +29,7 @@
#include "IDBKeyPath.h"
#include "ScriptWrappable.h"
-#include <bindings/ScriptValue.h>
+#include <runtime/JSCJSValue.h>
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -70,7 +70,7 @@
return adoptRef(new IDBAny(keyPath));
}
- static RefPtr<IDBAny> create(const Deprecated::ScriptValue& value)
+ static RefPtr<IDBAny> create(const JSC::JSValue& value)
{
return adoptRef(new IDBAny(value));
}
@@ -108,7 +108,7 @@
RefPtr<IDBIndex> idbIndex();
RefPtr<IDBObjectStore> idbObjectStore();
RefPtr<IDBTransaction> idbTransaction();
- const Deprecated::ScriptValue& scriptValue();
+ JSC::JSValue scriptValue();
int64_t integer();
const String& string();
const IDBKeyPath& keyPath();
@@ -120,7 +120,7 @@
explicit IDBAny(Ref<IDBIndex>&&);
explicit IDBAny(Ref<IDBCursor>&&);
explicit IDBAny(const IDBKeyPath&);
- explicit IDBAny(const Deprecated::ScriptValue&);
+ explicit IDBAny(const JSC::JSValue&);
IDBAny::Type m_type { IDBAny::Type::Undefined };
RefPtr<IDBDatabase> m_database;
@@ -130,7 +130,7 @@
RefPtr<IDBCursorWithValue> m_cursorWithValue;
const IDBKeyPath m_idbKeyPath;
- const Deprecated::ScriptValue m_scriptValue;
+ const JSC::JSValue m_scriptValue;
const String m_string;
const int64_t m_integer { 0 };
};
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -40,6 +40,8 @@
#include "ScriptExecutionContext.h"
#include <wtf/NeverDestroyed.h>
+using namespace JSC;
+
namespace WebCore {
const AtomicString& IDBCursor::directionNext()
@@ -157,19 +159,19 @@
return IDBCursor::directionToString(m_info.cursorDirection());
}
-const Deprecated::ScriptValue& IDBCursor::key() const
+JSValue IDBCursor::key(ExecState&) const
{
- return m_deprecatedCurrentKey;
+ return m_currentKey;
}
-const Deprecated::ScriptValue& IDBCursor::primaryKey() const
+JSValue IDBCursor::primaryKey(ExecState&) const
{
- return m_deprecatedCurrentPrimaryKey;
+ return m_currentPrimaryKey;
}
-const Deprecated::ScriptValue& IDBCursor::value() const
+JSValue IDBCursor::value(ExecState&) const
{
- return m_deprecatedCurrentValue;
+ return m_currentValue;
}
IDBAny* IDBCursor::source()
@@ -224,7 +226,7 @@
}
}
- auto request = effectiveObjectStore().putForCursorUpdate(exec, value.jsValue(), m_deprecatedCurrentPrimaryKey.jsValue(), ec);
+ auto request = effectiveObjectStore().putForCursorUpdate(exec, value.jsValue(), m_currentPrimaryKey, ec);
if (ec.code)
return nullptr;
@@ -280,10 +282,9 @@
void IDBCursor::continueFunction(ScriptExecutionContext& context, const Deprecated::ScriptValue& keyValue, ExceptionCodeWithMessage& ec)
{
- DOMRequestState requestState(&context);
RefPtr<IDBKey> key;
if (!keyValue.jsValue().isUndefined())
- key = scriptValueToIDBKey(&requestState, keyValue);
+ key = scriptValueToIDBKey(context, keyValue);
continueFunction(key.get(), ec);
}
@@ -380,7 +381,7 @@
return nullptr;
}
- auto request = effectiveObjectStore().modernDelete(context, m_deprecatedCurrentPrimaryKey.jsValue(), ec);
+ auto request = effectiveObjectStore().modernDelete(context, m_currentPrimaryKey, ec);
if (ec.code)
return nullptr;
@@ -400,25 +401,25 @@
return;
if (!getResult.isDefined()) {
- m_deprecatedCurrentKey = { };
+ m_currentKey = { };
m_currentKeyData = { };
- m_deprecatedCurrentPrimaryKey = { };
+ m_currentPrimaryKey = { };
m_currentPrimaryKeyData = { };
- m_deprecatedCurrentValue = { };
+ m_currentValue = { };
m_gotValue = false;
return;
}
- m_deprecatedCurrentKey = idbKeyDataToScriptValue(context, getResult.keyData());
+ m_currentKey = idbKeyDataToScriptValue(*context, getResult.keyData());
m_currentKeyData = getResult.keyData();
- m_deprecatedCurrentPrimaryKey = idbKeyDataToScriptValue(context, getResult.primaryKeyData());
+ m_currentPrimaryKey = idbKeyDataToScriptValue(*context, getResult.primaryKeyData());
m_currentPrimaryKeyData = getResult.primaryKeyData();
if (isKeyCursor())
- m_deprecatedCurrentValue = { };
+ m_currentValue = { };
else
- m_deprecatedCurrentValue = deserializeIDBValueData(*context, getResult.value().data());
+ m_currentValue = deserializeIDBValueDataToJSValue(*context, getResult.value().data());
m_gotValue = true;
}
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h 2016-04-11 21:31:53 UTC (rev 199310)
@@ -31,6 +31,7 @@
#include "ExceptionCode.h"
#include "IDBAny.h"
#include "IDBCursorInfo.h"
+#include <runtime/JSCJSValue.h>
namespace WebCore {
@@ -56,9 +57,9 @@
// Implement the IDL
const String& direction() const;
- const Deprecated::ScriptValue& key() const;
- const Deprecated::ScriptValue& primaryKey() const;
- const Deprecated::ScriptValue& value() const;
+ JSC::JSValue key(JSC::ExecState&) const;
+ JSC::JSValue primaryKey(JSC::ExecState&) const;
+ JSC::JSValue value(JSC::ExecState&) const;
IDBAny* source();
RefPtr<WebCore::IDBRequest> update(JSC::ExecState&, Deprecated::ScriptValue&, ExceptionCodeWithMessage&);
@@ -111,11 +112,9 @@
IDBKeyData m_currentKeyData;
IDBKeyData m_currentPrimaryKeyData;
- // FIXME: When ditching Legacy IDB and combining this implementation with the abstract IDBCursor,
- // these Deprecated::ScriptValue members should be JSValues instead.
- Deprecated::ScriptValue m_deprecatedCurrentKey;
- Deprecated::ScriptValue m_deprecatedCurrentPrimaryKey;
- Deprecated::ScriptValue m_deprecatedCurrentValue;
+ JSC::JSValue m_currentKey;
+ JSC::JSValue m_currentPrimaryKey;
+ JSC::JSValue m_currentValue;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl 2016-04-11 21:31:53 UTC (rev 199310)
@@ -32,8 +32,8 @@
] interface IDBCursor {
readonly attribute IDBAny source;
readonly attribute DOMString direction;
- readonly attribute any key;
- readonly attribute any primaryKey;
+ [CallWith=ScriptState, ImplementationReturnType=JSValue] readonly attribute any key;
+ [CallWith=ScriptState, ImplementationReturnType=JSValue] readonly attribute any primaryKey;
[CallWith=ScriptState, RaisesExceptionWithMessage] IDBRequest update(any value);
[RaisesExceptionWithMessage] void advance([EnforceRange] unsigned long count);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl 2016-04-11 21:31:53 UTC (rev 199310)
@@ -30,5 +30,5 @@
SkipVTableValidation,
JSCustomMarkFunction,
] interface IDBCursorWithValue : IDBCursor {
- readonly attribute any value;
+ [CallWith=ScriptState, ImplementationReturnType=JSValue] readonly attribute any value;
};
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -149,9 +149,8 @@
short IDBFactory::cmp(ScriptExecutionContext& context, const Deprecated::ScriptValue& firstValue, const Deprecated::ScriptValue& secondValue, ExceptionCodeWithMessage& ec)
{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> first = scriptValueToIDBKey(&requestState, firstValue);
- RefPtr<IDBKey> second = scriptValueToIDBKey(&requestState, secondValue);
+ RefPtr<IDBKey> first = scriptValueToIDBKey(context, firstValue);
+ RefPtr<IDBKey> second = scriptValueToIDBKey(context, secondValue);
ASSERT(first);
ASSERT(second);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -160,8 +160,7 @@
{
LOG(IndexedDB, "IDBIndex::count");
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
ec.code = IDBDatabaseException::DataError;
ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.");
@@ -242,8 +241,7 @@
{
LOG(IndexedDB, "IDBIndex::get");
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
ec.code = IDBDatabaseException::DataError;
ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key.");
@@ -287,8 +285,7 @@
{
LOG(IndexedDB, "IDBIndex::getKey");
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
ec.code = IDBDatabaseException::DataError;
ec.message = ASCIILiteral("Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key.");
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -30,9 +30,12 @@
#include "IDBBindingUtilities.h"
#include "IDBDatabaseException.h"
#include "IDBKey.h"
+#include "IDBKeyData.h"
#if ENABLE(INDEXED_DATABASE)
+using namespace JSC;
+
namespace WebCore {
Ref<IDBKeyRange> IDBKeyRange::create(RefPtr<IDBKey>&& key)
@@ -49,16 +52,14 @@
{
}
-Deprecated::ScriptValue IDBKeyRange::lowerValue(ScriptExecutionContext& context) const
+JSValue IDBKeyRange::lowerValue(ScriptExecutionContext& context) const
{
- DOMRequestState requestState(&context);
- return idbKeyToScriptValue(&requestState, m_lower);
+ return idbKeyDataToScriptValue(context, IDBKeyData(m_lower.get()));
}
-Deprecated::ScriptValue IDBKeyRange::upperValue(ScriptExecutionContext& context) const
+JSValue IDBKeyRange::upperValue(ScriptExecutionContext& context) const
{
- DOMRequestState requestState(&context);
- return idbKeyToScriptValue(&requestState, m_upper);
+ return idbKeyDataToScriptValue(context, IDBKeyData(m_upper.get()));
}
RefPtr<IDBKeyRange> IDBKeyRange::only(RefPtr<IDBKey>&& key, ExceptionCode& ec)
@@ -73,8 +74,7 @@
RefPtr<IDBKeyRange> IDBKeyRange::only(ScriptExecutionContext& context, const Deprecated::ScriptValue& keyValue, ExceptionCode& ec)
{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> key = scriptValueToIDBKey(&requestState, keyValue);
+ RefPtr<IDBKey> key = scriptValueToIDBKey(context, keyValue);
if (!key || !key->isValid()) {
ec = IDBDatabaseException::DataError;
return nullptr;
@@ -85,8 +85,7 @@
RefPtr<IDBKeyRange> IDBKeyRange::lowerBound(ScriptExecutionContext& context, const Deprecated::ScriptValue& boundValue, bool open, ExceptionCode& ec)
{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> bound = scriptValueToIDBKey(&requestState, boundValue);
+ RefPtr<IDBKey> bound = scriptValueToIDBKey(context, boundValue);
if (!bound || !bound->isValid()) {
ec = IDBDatabaseException::DataError;
return nullptr;
@@ -97,8 +96,7 @@
RefPtr<IDBKeyRange> IDBKeyRange::upperBound(ScriptExecutionContext& context, const Deprecated::ScriptValue& boundValue, bool open, ExceptionCode& ec)
{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> bound = scriptValueToIDBKey(&requestState, boundValue);
+ RefPtr<IDBKey> bound = scriptValueToIDBKey(context, boundValue);
if (!bound || !bound->isValid()) {
ec = IDBDatabaseException::DataError;
return nullptr;
@@ -109,9 +107,8 @@
RefPtr<IDBKeyRange> IDBKeyRange::bound(ScriptExecutionContext& context, const Deprecated::ScriptValue& lowerValue, const Deprecated::ScriptValue& upperValue, bool lowerOpen, bool upperOpen, ExceptionCode& ec)
{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> lower = scriptValueToIDBKey(&requestState, lowerValue);
- RefPtr<IDBKey> upper = scriptValueToIDBKey(&requestState, upperValue);
+ RefPtr<IDBKey> lower = scriptValueToIDBKey(context, lowerValue);
+ RefPtr<IDBKey> upper = scriptValueToIDBKey(context, upperValue);
if (!lower || !lower->isValid() || !upper || !upper->isValid()) {
ec = IDBDatabaseException::DataError;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h 2016-04-11 21:31:53 UTC (rev 199310)
@@ -58,8 +58,8 @@
IDBKey* lower() const { return m_lower.get(); }
IDBKey* upper() const { return m_upper.get(); }
- Deprecated::ScriptValue lowerValue(ScriptExecutionContext&) const;
- Deprecated::ScriptValue upperValue(ScriptExecutionContext&) const;
+ JSC::JSValue lowerValue(ScriptExecutionContext&) const;
+ JSC::JSValue upperValue(ScriptExecutionContext&) const;
bool lowerOpen() const { return m_lowerType == LowerBoundOpen; }
bool upperOpen() const { return m_upperType == UpperBoundOpen; }
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl 2016-04-11 21:31:53 UTC (rev 199310)
@@ -28,8 +28,8 @@
ImplementationLacksVTable,
EnabledAtRuntime=IndexedDB,
] interface IDBKeyRange {
- [ImplementedAs=lowerValue,CallWith=ScriptExecutionContext] readonly attribute any lower;
- [ImplementedAs=upperValue,CallWith=ScriptExecutionContext] readonly attribute any upper;
+ [ImplementedAs=lowerValue, CallWith=ScriptExecutionContext, ImplementationReturnType=JSValue] readonly attribute any lower;
+ [ImplementedAs=upperValue, CallWith=ScriptExecutionContext, ImplementationReturnType=JSValue] readonly attribute any upper;
readonly attribute boolean lowerOpen;
readonly attribute boolean upperOpen;
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -182,8 +182,7 @@
return nullptr;
}
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
ec.code = IDBDatabaseException::DataError;
ec.message = ASCIILiteral("Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.");
@@ -399,8 +398,7 @@
RefPtr<IDBRequest> IDBObjectStore::modernDelete(ScriptExecutionContext& context, JSC::JSValue key, ExceptionCodeWithMessage& ec)
{
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
ec.code = IDBDatabaseException::DataError;
ec.message = ASCIILiteral("Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.");
@@ -594,8 +592,7 @@
{
LOG(IndexedDB, "IDBObjectStore::count");
- DOMRequestState requestState(&context);
- RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(context, key);
if (!idbKey || idbKey->type() == KeyType::Invalid) {
ec.code = IDBDatabaseException::DataError;
ec.message = ASCIILiteral("Failed to execute 'count' on 'IDBObjectStore': The parameter is not a valid key.");
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -326,13 +326,13 @@
void IDBRequest::setResult(const IDBKeyData* keyData)
{
- if (!keyData) {
+ auto* context = scriptExecutionContext();
+ if (!context || !keyData) {
m_result = nullptr;
return;
}
- Deprecated::ScriptValue value = idbKeyDataToScriptValue(scriptExecutionContext(), *keyData);
- m_result = IDBAny::create(WTFMove(value));
+ m_result = IDBAny::create(idbKeyDataToScriptValue(*context, *keyData));
}
void IDBRequest::setResult(uint64_t number)
@@ -349,7 +349,7 @@
if (!context)
return;
- Deprecated::ScriptValue value = deserializeIDBValueData(*context, valueData);
+ auto value = deserializeIDBValueDataToJSValue(*context, valueData);
m_result = IDBAny::create(WTFMove(value));
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (199309 => 199310)
--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -301,7 +301,7 @@
{
JSLockHolder locker(UniqueIDBDatabase::databaseThreadVM());
- auto jsValue = idbValueDataToJSValue(UniqueIDBDatabase::databaseThreadExecState(), value);
+ auto jsValue = deserializeIDBValueDataToJSValue(UniqueIDBDatabase::databaseThreadExecState(), value);
if (jsValue.isUndefinedOrNull())
return { };
@@ -339,7 +339,7 @@
JSLockHolder locker(UniqueIDBDatabase::databaseThreadVM());
for (auto iterator : *m_keyValueStore) {
- auto jsValue = idbValueDataToJSValue(UniqueIDBDatabase::databaseThreadExecState(), iterator.value);
+ auto jsValue = deserializeIDBValueDataToJSValue(UniqueIDBDatabase::databaseThreadExecState(), iterator.value);
if (jsValue.isUndefinedOrNull())
return { };
Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp (199309 => 199310)
--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -37,9 +37,11 @@
#include "IndexKey.h"
#include "JSDOMBinding.h"
#include "Logging.h"
+#include "ScriptState.h"
#include "SharedBuffer.h"
#include "ThreadSafeDataBuffer.h"
+#include <bindings/ScriptValue.h>
#include <runtime/DateInstance.h>
#include <runtime/ObjectConstructor.h>
@@ -77,43 +79,6 @@
return true;
}
-JSValue idbKeyDataToJSValue(JSC::ExecState& exec, const IDBKeyData& keyData)
-{
- if (keyData.isNull())
- return jsUndefined();
-
- Locker<JSLock> locker(exec.vm().apiLock());
-
- switch (keyData.type()) {
- case KeyType::Array:
- {
- const Vector<IDBKeyData>& inArray = keyData.array();
- size_t size = inArray.size();
- JSArray* outArray = constructEmptyArray(&exec, 0, exec.lexicalGlobalObject(), size);
- for (size_t i = 0; i < size; ++i) {
- auto& arrayKey = inArray.at(i);
- outArray->putDirectIndex(&exec, i, idbKeyDataToJSValue(exec, arrayKey));
- }
- return JSValue(outArray);
- }
- case KeyType::String:
- return jsStringWithCache(&exec, keyData.string());
- case KeyType::Date:
- return jsDateOrNull(&exec, keyData.date());
- case KeyType::Number:
- return jsNumber(keyData.number());
- case KeyType::Min:
- case KeyType::Max:
- case KeyType::Invalid:
- ASSERT_NOT_REACHED();
- return jsUndefined();
- }
-
- ASSERT_NOT_REACHED();
- return jsUndefined();
-
-}
-
static JSValue idbKeyToJSValue(ExecState* exec, JSGlobalObject* globalObject, IDBKey* key)
{
if (!key || !exec) {
@@ -201,13 +166,13 @@
return IDBKey::createInvalid();
}
-IDBKeyPath idbKeyPathFromValue(ExecState* exec, JSValue keyPathValue)
+IDBKeyPath idbKeyPathFromValue(ExecState& exec, JSValue keyPathValue)
{
IDBKeyPath keyPath;
if (isJSArray(keyPathValue))
- keyPath = IDBKeyPath(toNativeArray<String>(exec, keyPathValue));
+ keyPath = IDBKeyPath(toNativeArray<String>(&exec, keyPathValue));
else
- keyPath = IDBKeyPath(keyPathValue.toString(exec)->value(exec));
+ keyPath = IDBKeyPath(keyPathValue.toString(&exec)->value(&exec));
return keyPath;
}
@@ -273,32 +238,6 @@
return true;
}
-bool injectIDBKeyIntoScriptValue(DOMRequestState* requestState, PassRefPtr<IDBKey> key, Deprecated::ScriptValue& value, const IDBKeyPath& keyPath)
-{
- LOG(StorageAPI, "injectIDBKeyIntoScriptValue");
-
- ASSERT(keyPath.type() == IndexedDB::KeyPathType::String);
-
- Vector<String> keyPathElements;
- IDBKeyPathParseError error;
- IDBParseKeyPath(keyPath.string(), keyPathElements, error);
- ASSERT(error == IDBKeyPathParseError::None);
-
- if (keyPathElements.isEmpty())
- return false;
-
- ExecState* exec = requestState->exec();
-
- JSValue parent = ensureNthValueOnKeyPath(exec, value.jsValue(), keyPathElements, keyPathElements.size() - 1);
- if (parent.isUndefined())
- return false;
-
- if (!set(exec, parent, keyPathElements.last(), idbKeyToJSValue(exec, exec->lexicalGlobalObject(), key.get())))
- return false;
-
- return true;
-}
-
bool injectIDBKeyIntoScriptValue(JSC::ExecState& exec, const IDBKeyData& keyData, JSC::JSValue value, const IDBKeyPath& keyPath)
{
LOG(IndexedDB, "injectIDBKeyIntoScriptValue");
@@ -327,47 +266,6 @@
return true;
}
-RefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue& value, const IDBKeyPath& keyPath)
-{
- LOG(StorageAPI, "createIDBKeyFromScriptValueAndKeyPath");
- ASSERT(!keyPath.isNull());
-
- if (keyPath.type() == IndexedDB::KeyPathType::Array) {
- Vector<RefPtr<IDBKey>> result;
- const Vector<String>& array = keyPath.array();
- for (size_t i = 0; i < array.size(); i++) {
- RefPtr<IDBKey> key = internalCreateIDBKeyFromScriptValueAndKeyPath(exec, value, array[i]);
- if (!key)
- return nullptr;
- result.append(key);
- }
- return IDBKey::createArray(result);
- }
-
- ASSERT(keyPath.type() == IndexedDB::KeyPathType::String);
- return internalCreateIDBKeyFromScriptValueAndKeyPath(exec, value, keyPath.string());
-}
-
-RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(ExecState& exec, const Deprecated::ScriptValue& value, const IDBKeyPath& keyPath)
-{
- ASSERT(!keyPath.isNull());
-
- if (keyPath.type() == IndexedDB::KeyPathType::Array) {
- Vector<RefPtr<IDBKey>> result;
- const Vector<String>& array = keyPath.array();
- for (size_t i = 0; i < array.size(); i++) {
- RefPtr<IDBKey> key = internalCreateIDBKeyFromScriptValueAndKeyPath(&exec, value, array[i]);
- if (!key)
- return nullptr;
- result.append(key);
- }
- return IDBKey::createArray(result);
- }
-
- ASSERT(keyPath.type() == IndexedDB::KeyPathType::String);
- return internalCreateIDBKeyFromScriptValueAndKeyPath(&exec, value, keyPath.string());
-}
-
RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(ExecState& exec, const JSC::JSValue& value, const IDBKeyPath& keyPath)
{
ASSERT(!keyPath.isNull());
@@ -389,17 +287,6 @@
return internalCreateIDBKeyFromScriptValueAndKeyPath(&exec, value, keyPath.string());
}
-bool canInjectIDBKeyIntoScriptValue(DOMRequestState* requestState, const JSC::JSValue& scriptValue, const IDBKeyPath& keyPath)
-{
- LOG(StorageAPI, "canInjectIDBKeyIntoScriptValue");
-
- JSC::ExecState* exec = requestState->exec();
- if (!exec)
- return false;
-
- return canInjectIDBKeyIntoScriptValue(*exec, scriptValue, keyPath);
-}
-
bool canInjectIDBKeyIntoScriptValue(JSC::ExecState& execState, const JSC::JSValue& scriptValue, const IDBKeyPath& keyPath)
{
LOG(StorageAPI, "canInjectIDBKeyIntoScriptValue");
@@ -416,30 +303,16 @@
return canInjectNthValueOnKeyPath(&execState, scriptValue, keyPathElements, keyPathElements.size() - 1);
}
-Deprecated::ScriptValue deserializeIDBValue(DOMRequestState* requestState, PassRefPtr<SerializedScriptValue> prpValue)
+JSValue deserializeIDBValueDataToJSValue(ScriptExecutionContext& context, const ThreadSafeDataBuffer& valueData)
{
- ExecState* exec = requestState->exec();
- RefPtr<SerializedScriptValue> serializedValue = prpValue;
- JSValue result;
- if (serializedValue)
- result = serializedValue->deserialize(exec, exec->lexicalGlobalObject(), 0);
- else
- result = jsNull();
- return Deprecated::ScriptValue(exec->vm(), result);
-}
+ auto* state = context.execState();
+ if (!state)
+ return jsNull();
-Deprecated::ScriptValue deserializeIDBValueData(ScriptExecutionContext& context, const ThreadSafeDataBuffer& valueData)
-{
- DOMRequestState state(&context);
- auto* execState = state.exec();
-
- if (!execState)
- return Deprecated::ScriptValue();
-
- return Deprecated::ScriptValue(execState->vm(), deserializeIDBValueDataToJSValue(*execState, valueData));
+ return deserializeIDBValueDataToJSValue(*state, valueData);
}
-JSC::JSValue deserializeIDBValueDataToJSValue(JSC::ExecState& exec, const ThreadSafeDataBuffer& valueData)
+JSValue deserializeIDBValueDataToJSValue(JSC::ExecState& exec, const ThreadSafeDataBuffer& valueData)
{
if (!valueData.data())
return jsUndefined();
@@ -458,74 +331,24 @@
return result;
}
-Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState* requestState, PassRefPtr<SharedBuffer> prpBuffer, bool keyIsDefined)
+RefPtr<IDBKey> scriptValueToIDBKey(ScriptExecutionContext& context, const JSC::JSValue& scriptValue)
{
- if (prpBuffer) {
- Vector<uint8_t> value;
- value.append(prpBuffer->data(), prpBuffer->size());
- return deserializeIDBValueBuffer(requestState->exec(), WTFMove(value), keyIsDefined);
- }
-
- return Deprecated::ScriptValue(requestState->exec()->vm(), jsNull());
+ return createIDBKeyFromValue(context.execState(), scriptValue);
}
-static JSValue idbValueDataToJSValue(JSC::ExecState& exec, Vector<uint8_t>&& buffer)
+RefPtr<IDBKey> scriptValueToIDBKey(ExecState& state, const JSC::JSValue& scriptValue)
{
- if (buffer.isEmpty())
- return jsNull();
-
- RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::createFromWireBytes(WTFMove(buffer));
- return serializedValue->deserialize(&exec, exec.lexicalGlobalObject(), 0, NonThrowing);
+ return createIDBKeyFromValue(&state, scriptValue);
}
-Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState* exec, Vector<uint8_t>&& buffer, bool keyIsDefined)
+JSC::JSValue idbKeyDataToScriptValue(ScriptExecutionContext& context, const IDBKeyData& keyData)
{
- ASSERT(exec);
-
- // If the key doesn't exist, then the value must be undefined (as opposed to null).
- if (!keyIsDefined) {
- // We either shouldn't have a buffer or it should be of size 0.
- ASSERT(!buffer.size());
- return Deprecated::ScriptValue(exec->vm(), jsUndefined());
- }
-
- JSValue result = idbValueDataToJSValue(*exec, WTFMove(buffer));
- return Deprecated::ScriptValue(exec->vm(), result);
-}
-
-JSValue idbValueDataToJSValue(JSC::ExecState& exec, const ThreadSafeDataBuffer& valueData)
-{
- if (!valueData.data())
+ auto* exec = context.execState();
+ if (!exec)
return jsUndefined();
- return idbValueDataToJSValue(exec, Vector<uint8_t>(*valueData.data()));
-}
-
-Deprecated::ScriptValue idbKeyToScriptValue(DOMRequestState* requestState, PassRefPtr<IDBKey> key)
-{
- ExecState* exec = requestState->exec();
- if (!exec)
- return { };
-
- return Deprecated::ScriptValue(exec->vm(), idbKeyToJSValue(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), key.get()));
-}
-
-RefPtr<IDBKey> scriptValueToIDBKey(DOMRequestState* requestState, const JSC::JSValue& scriptValue)
-{
- ExecState* exec = requestState->exec();
- return createIDBKeyFromValue(exec, scriptValue);
-}
-
-RefPtr<IDBKey> scriptValueToIDBKey(ExecState& exec, const JSC::JSValue& scriptValue)
-{
- return createIDBKeyFromValue(&exec, scriptValue);
-}
-
-Deprecated::ScriptValue idbKeyDataToScriptValue(ScriptExecutionContext* context, const IDBKeyData& keyData)
-{
RefPtr<IDBKey> key = keyData.maybeCreateIDBKey();
- DOMRequestState requestState(context);
- return idbKeyToScriptValue(&requestState, key.get());
+ return Deprecated::ScriptValue(exec->vm(), idbKeyToJSValue(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), key.get())).jsValue();
}
static Vector<IDBKeyData> createKeyPathArray(ExecState& exec, JSValue value, const IDBIndexInfo& info)
Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h (199309 => 199310)
--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h 2016-04-11 21:31:53 UTC (rev 199310)
@@ -29,49 +29,32 @@
#if ENABLE(INDEXED_DATABASE)
#include "Dictionary.h"
-#include <bindings/ScriptValue.h>
#include <wtf/Forward.h>
namespace WebCore {
-class DOMRequestState;
class IDBIndexInfo;
class IDBKey;
class IDBKeyData;
class IDBKeyPath;
class IndexKey;
-class SharedBuffer;
class ThreadSafeDataBuffer;
-IDBKeyPath idbKeyPathFromValue(JSC::ExecState*, JSC::JSValue);
+IDBKeyPath idbKeyPathFromValue(JSC::ExecState&, JSC::JSValue);
-bool injectIDBKeyIntoScriptValue(DOMRequestState*, PassRefPtr<IDBKey>, Deprecated::ScriptValue&, const IDBKeyPath&);
-bool injectIDBKeyIntoScriptValue(JSC::ExecState&, const IDBKeyData&, JSC::JSValue, const IDBKeyPath&);
-
-RefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(JSC::ExecState*, const Deprecated::ScriptValue&, const IDBKeyPath&);
-RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(JSC::ExecState&, const Deprecated::ScriptValue&, const IDBKeyPath&);
RefPtr<IDBKey> maybeCreateIDBKeyFromScriptValueAndKeyPath(JSC::ExecState&, const JSC::JSValue&, const IDBKeyPath&);
-
-bool canInjectIDBKeyIntoScriptValue(DOMRequestState*, const JSC::JSValue&, const IDBKeyPath&);
bool canInjectIDBKeyIntoScriptValue(JSC::ExecState&, const JSC::JSValue&, const IDBKeyPath&);
+bool injectIDBKeyIntoScriptValue(JSC::ExecState&, const IDBKeyData&, JSC::JSValue, const IDBKeyPath&);
-Deprecated::ScriptValue deserializeIDBValue(DOMRequestState*, PassRefPtr<SerializedScriptValue>);
-Deprecated::ScriptValue deserializeIDBValueData(ScriptExecutionContext&, const ThreadSafeDataBuffer& valueData);
-Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState*, PassRefPtr<SharedBuffer>, bool keyIsDefined);
-WEBCORE_EXPORT Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState*, Vector<uint8_t>&&, bool keyIsDefined);
+JSC::JSValue idbKeyDataToScriptValue(ScriptExecutionContext&, const IDBKeyData&);
+void generateIndexKeyForValue(JSC::ExecState&, const IDBIndexInfo&, JSC::JSValue, IndexKey& outKey);
+JSC::JSValue deserializeIDBValueDataToJSValue(ScriptExecutionContext&, const ThreadSafeDataBuffer& valueData);
JSC::JSValue deserializeIDBValueDataToJSValue(JSC::ExecState&, const ThreadSafeDataBuffer& valueData);
-Deprecated::ScriptValue idbKeyToScriptValue(DOMRequestState*, PassRefPtr<IDBKey>);
-RefPtr<IDBKey> scriptValueToIDBKey(DOMRequestState*, const JSC::JSValue&);
+RefPtr<IDBKey> scriptValueToIDBKey(ScriptExecutionContext&, const JSC::JSValue&);
RefPtr<IDBKey> scriptValueToIDBKey(JSC::ExecState&, const JSC::JSValue&);
-Deprecated::ScriptValue idbKeyDataToScriptValue(ScriptExecutionContext*, const IDBKeyData&);
-
-JSC::JSValue idbValueDataToJSValue(JSC::ExecState&, const ThreadSafeDataBuffer& valueData);
-void generateIndexKeyForValue(JSC::ExecState&, const IDBIndexInfo&, JSC::JSValue, IndexKey& outKey);
-JSC::JSValue idbKeyDataToJSValue(JSC::ExecState&, const IDBKeyData&);
-
}
#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp (199309 => 199310)
--- trunk/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/bindings/js/JSIDBAnyCustom.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -98,7 +98,7 @@
case IDBAny::Type::IDBTransaction:
return toJS(exec, globalObject, idbAny->idbTransaction());
case IDBAny::Type::ScriptValue:
- return idbAny->scriptValue().jsValue();
+ return idbAny->scriptValue();
case IDBAny::Type::String:
return jsStringWithCache(exec, idbAny->string());
case IDBAny::Type::Integer:
Modified: trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp (199309 => 199310)
--- trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -66,7 +66,7 @@
return jsUndefined();
if (!keyPathValue.isUndefinedOrNull()) {
- keyPath = idbKeyPathFromValue(&state, keyPathValue);
+ keyPath = idbKeyPathFromValue(state, keyPathValue);
if (state.hadException())
return jsUndefined();
}
Modified: trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp (199309 => 199310)
--- trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -119,7 +119,7 @@
IDBKeyPath keyPath;
JSValue keyPathValue = state.argument(1);
if (!keyPathValue.isUndefinedOrNull())
- keyPath = idbKeyPathFromValue(&state, keyPathValue);
+ keyPath = idbKeyPathFromValue(state, keyPathValue);
else {
ExceptionCodeWithMessage ec;
ec.code = IDBDatabaseException::SyntaxError;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (199309 => 199310)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-11 21:31:53 UTC (rev 199310)
@@ -4358,9 +4358,12 @@
return "jsArray(state, $thisValue->globalObject(), $value)";
}
+ my $returnType = $signature->extendedAttributes->{"ImplementationReturnType"};
if ($type eq "any") {
if ($interfaceName eq "Document") {
AddToImplIncludes("JSCanvasRenderingContext2D.h", $conditional);
+ } elsif (defined $returnType and $returnType eq "JSValue") {
+ return "$value";
} else {
return "($value.hasNoValue() ? jsNull() : $value.jsValue())";
}
Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (199309 => 199310)
--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2016-04-11 21:31:53 UTC (rev 199310)
@@ -67,9 +67,10 @@
GetterRaisesExceptionWithMessage
GlobalContext=DOMWindow|WorkerGlobalScope|DedicatedWorkerGlobalScope
Immutable
+ImplementedAs=*
ImplementationLacksVTable
ImplementationNamespace=*
-ImplementedAs=*
+ImplementationReturnType=*
ImplicitThis
InitializedByEventConstructor
InterfaceName=*
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.cpp (199309 => 199310)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -487,4 +487,15 @@
return false;
}
+JSC::ExecState* ScriptExecutionContext::execState()
+{
+ if (is<Document>(*this)) {
+ Document& document = downcast<Document>(*this);
+ return execStateFromPage(mainThreadNormalWorld(), document.page());
+ }
+
+ WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(this);
+ return execStateFromWorkerGlobalScope(workerGlobalScope);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/ScriptExecutionContext.h (199309 => 199310)
--- trunk/Source/WebCore/dom/ScriptExecutionContext.h 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/dom/ScriptExecutionContext.h 2016-04-11 21:31:53 UTC (rev 199310)
@@ -188,6 +188,8 @@
int timerNestingLevel() const { return m_timerNestingLevel; }
void setTimerNestingLevel(int timerNestingLevel) { m_timerNestingLevel = timerNestingLevel; }
+ JSC::ExecState* execState();
+
protected:
class AddConsoleMessageTask : public Task {
public:
Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (199309 => 199310)
--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp 2016-04-11 20:10:36 UTC (rev 199309)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp 2016-04-11 21:31:53 UTC (rev 199310)
@@ -44,6 +44,7 @@
#include "EventTarget.h"
#include "ExceptionCode.h"
#include "Frame.h"
+#include "IDBBindingUtilities.h"
#include "IDBCursor.h"
#include "IDBCursorWithValue.h"
#include "IDBDatabase.h"
@@ -333,7 +334,7 @@
return this == &other;
}
- void handleEvent(ScriptExecutionContext*, Event* event) override
+ void handleEvent(ScriptExecutionContext* context, Event* event) override
{
if (event->type() != eventNames().successEvent) {
m_requestCallback->sendFailure("Unexpected event type.");
@@ -380,10 +381,14 @@
return;
}
+ JSC::ExecState* state = context ? context->execState() : nullptr;
+ if (!state)
+ return;
+
RefPtr<DataEntry> dataEntry = DataEntry::create()
- .setKey(m_injectedScript.wrapObject(idbCursor->key(), String(), true))
- .setPrimaryKey(m_injectedScript.wrapObject(idbCursor->primaryKey(), String(), true))
- .setValue(m_injectedScript.wrapObject(idbCursor->value(), String(), true))
+ .setKey(m_injectedScript.wrapObject({ state->vm(), idbCursor->key(*state) }, String(), true))
+ .setPrimaryKey(m_injectedScript.wrapObject({ state->vm(), idbCursor->primaryKey(*state) }, String(), true))
+ .setValue(m_injectedScript.wrapObject({ state->vm(), idbCursor->value(*state) }, String(), true))
.release();
m_result->addItem(WTFMove(dataEntry));