Diff
Modified: trunk/Source/WebCore/ChangeLog (199703 => 199704)
--- trunk/Source/WebCore/ChangeLog 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/ChangeLog 2016-04-19 02:58:44 UTC (rev 199704)
@@ -1,3 +1,48 @@
+2016-04-18 Darin Adler <[email protected]>
+
+ Remove all use of Deprecated::ScriptValue in generated bindings
+ https://bugs.webkit.org/show_bug.cgi?id=156706
+
+ Reviewed by Brady Eidson.
+
+ * Modules/indexeddb/IDBCursor.idl: Removed unneeded [ImplementationReturnType=JSValue].
+ * Modules/indexeddb/IDBCursorWithValue.idl: Ditto.
+
+ * Modules/indexeddb/IDBKeyRange.cpp:
+ (WebCore::IDBKeyRange::lowerValue): Deleted.
+ (WebCore::IDBKeyRange::upperValue): Deleted.
+ (WebCore::IDBKeyRange::only): Changed to take ExecState since the old code just used
+ the ScriptExecutionContext to get back to the (potentially wrong) ExecState. Also kept
+ one overload that takes ScriptExecutionContext because I could not change all callers.
+ (WebCore::IDBKeyRange::lowerBound): Ditto.
+ (WebCore::IDBKeyRange::upperBound): Ditto.
+ (WebCore::IDBKeyRange::bound): Ditto.
+
+ * Modules/indexeddb/IDBKeyRange.h: Updated for above.
+
+ * Modules/indexeddb/IDBKeyRange.idl: Use [ImplementationReturnType=IDBKey].
+ Use ScriptState instead of ScriptExecutionContext.
+
+ * Modules/streams/ReadableStreamSource.h: Take JSValue instead of Deprecated::ScriptValue
+ for the ignored argument to the cancel function.
+
+ * bindings/js/IDBBindingUtilities.cpp:
+ (WebCore::toJS): Renamed idbKeyToJSValue to this, the traditional name used in the
+ bindings generator for all these functions. Also changed to take references.
+ (WebCore::injectIDBKeyIntoScriptValue): Updated to call with the new name and types.
+ (WebCore::idbKeyDataToScriptValue): Ditto.
+
+ * bindings/js/IDBBindingUtilities.h: Added declaration of toJS for IDBKey.
+
+ * bindings/scripts/CodeGeneratorJS.pm: Use JSC::JSValue instead of Deprecated::ScriptValue
+ for the "any" type.
+ (JSValueToNative): Just return the value with no transformation when type is "any".
+ (NativeToJSValue): Changed default behavior for "any" to just pass the value as is with
+ no transfomration. Removed unused ImplementationReturnType case for inside Document.
+ Removed JSValue case since it's the default now. Added IDBKey case that matches the
+ IDBKeyPath case (still wondering if we can do those without an attribute). Removed bogus
+ second check for type "any".
+
2016-04-18 Martin Robinson <[email protected]>
[GTK] Possible off-by-one in hyphenation code
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl (199703 => 199704)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.idl 2016-04-19 02:58:44 UTC (rev 199704)
@@ -33,8 +33,8 @@
] interface IDBCursor {
[CustomGetter] readonly attribute any source;
readonly attribute DOMString direction;
- [ImplementationReturnType=JSValue] readonly attribute any key;
- [ImplementationReturnType=JSValue] readonly attribute any primaryKey;
+ readonly attribute any key;
+ 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 (199703 => 199704)
--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl 2016-04-19 02:58:44 UTC (rev 199704)
@@ -30,5 +30,5 @@
SkipVTableValidation,
JSCustomMarkFunction,
] interface IDBCursorWithValue : IDBCursor {
- [ImplementationReturnType=JSValue] readonly attribute any value;
+ readonly attribute any value;
};
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp (199703 => 199704)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp 2016-04-19 02:58:44 UTC (rev 199704)
@@ -61,16 +61,6 @@
{
}
-JSValue IDBKeyRange::lowerValue(ScriptExecutionContext& context) const
-{
- return idbKeyDataToScriptValue(context, IDBKeyData(m_lower.get()));
-}
-
-JSValue IDBKeyRange::upperValue(ScriptExecutionContext& context) const
-{
- return idbKeyDataToScriptValue(context, IDBKeyData(m_upper.get()));
-}
-
RefPtr<IDBKeyRange> IDBKeyRange::only(RefPtr<IDBKey>&& key, ExceptionCode& ec)
{
if (!key || !key->isValid()) {
@@ -81,20 +71,19 @@
return create(WTFMove(key));
}
-RefPtr<IDBKeyRange> IDBKeyRange::only(ScriptExecutionContext& context, JSValue keyValue, ExceptionCode& ec)
+RefPtr<IDBKeyRange> IDBKeyRange::only(ExecState& state, JSValue keyValue, ExceptionCode& ec)
{
- auto key = scriptValueToIDBKey(context, keyValue);
- if (!key || !key->isValid()) {
- ec = IDBDatabaseException::DataError;
- return nullptr;
- }
+ return only(scriptValueToIDBKey(state, keyValue), ec);
+}
- return create(WTFMove(key));
+RefPtr<IDBKeyRange> IDBKeyRange::only(ScriptExecutionContext& context, JSValue keyValue, ExceptionCode& ec)
+{
+ return only(scriptValueToIDBKey(context, keyValue), ec);
}
-RefPtr<IDBKeyRange> IDBKeyRange::lowerBound(ScriptExecutionContext& context, JSValue boundValue, bool open, ExceptionCode& ec)
+RefPtr<IDBKeyRange> IDBKeyRange::lowerBound(ExecState& state, JSValue boundValue, bool open, ExceptionCode& ec)
{
- auto bound = scriptValueToIDBKey(context, boundValue);
+ auto bound = scriptValueToIDBKey(state, boundValue);
if (!bound || !bound->isValid()) {
ec = IDBDatabaseException::DataError;
return nullptr;
@@ -103,9 +92,9 @@
return create(WTFMove(bound), nullptr, open, true);
}
-RefPtr<IDBKeyRange> IDBKeyRange::upperBound(ScriptExecutionContext& context, JSValue boundValue, bool open, ExceptionCode& ec)
+RefPtr<IDBKeyRange> IDBKeyRange::upperBound(ExecState& state, JSValue boundValue, bool open, ExceptionCode& ec)
{
- auto bound = scriptValueToIDBKey(context, boundValue);
+ auto bound = scriptValueToIDBKey(state, boundValue);
if (!bound || !bound->isValid()) {
ec = IDBDatabaseException::DataError;
return nullptr;
@@ -114,10 +103,10 @@
return create(nullptr, WTFMove(bound), true, open);
}
-RefPtr<IDBKeyRange> IDBKeyRange::bound(ScriptExecutionContext& context, JSValue lowerValue, JSValue upperValue, bool lowerOpen, bool upperOpen, ExceptionCode& ec)
+RefPtr<IDBKeyRange> IDBKeyRange::bound(ExecState& state, JSValue lowerValue, JSValue upperValue, bool lowerOpen, bool upperOpen, ExceptionCode& ec)
{
- auto lower = scriptValueToIDBKey(context, lowerValue);
- auto upper = scriptValueToIDBKey(context, upperValue);
+ auto lower = scriptValueToIDBKey(state, lowerValue);
+ auto upper = scriptValueToIDBKey(state, upperValue);
if (!lower || !lower->isValid() || !upper || !upper->isValid()) {
ec = IDBDatabaseException::DataError;
@@ -140,24 +129,24 @@
return m_lower && m_upper && !m_isLowerOpen && !m_isUpperOpen && m_lower->isEqual(m_upper.get());
}
-RefPtr<IDBKeyRange> IDBKeyRange::lowerBound(ScriptExecutionContext& context, JSValue bound, ExceptionCode& ec)
+RefPtr<IDBKeyRange> IDBKeyRange::lowerBound(ExecState& state, JSValue bound, ExceptionCode& ec)
{
- return lowerBound(context, bound, false, ec);
+ return lowerBound(state, bound, false, ec);
}
-RefPtr<IDBKeyRange> IDBKeyRange::upperBound(ScriptExecutionContext& context, JSValue bound, ExceptionCode& ec)
+RefPtr<IDBKeyRange> IDBKeyRange::upperBound(ExecState& state, JSValue bound, ExceptionCode& ec)
{
- return upperBound(context, bound, false, ec);
+ return upperBound(state, bound, false, ec);
}
-RefPtr<IDBKeyRange> IDBKeyRange::bound(ScriptExecutionContext& context, JSValue lower, JSValue upper, ExceptionCode& ec)
+RefPtr<IDBKeyRange> IDBKeyRange::bound(ExecState& state, JSValue lower, JSValue upper, ExceptionCode& ec)
{
- return bound(context, lower, upper, false, false, ec);
+ return bound(state, lower, upper, false, false, ec);
}
-RefPtr<IDBKeyRange> IDBKeyRange::bound(ScriptExecutionContext& context, JSValue lower, JSValue upper, bool lowerOpen, ExceptionCode& ec)
+RefPtr<IDBKeyRange> IDBKeyRange::bound(ExecState& state, JSValue lower, JSValue upper, bool lowerOpen, ExceptionCode& ec)
{
- return bound(context, lower, upper, lowerOpen, false, ec);
+ return bound(state, lower, upper, lowerOpen, false, ec);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h (199703 => 199704)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h 2016-04-19 02:58:44 UTC (rev 199704)
@@ -32,6 +32,7 @@
#include <wtf/RefPtr.h>
namespace JSC {
+class ExecState;
class JSValue;
}
@@ -50,25 +51,25 @@
IDBKey* lower() const { return m_lower.get(); }
IDBKey* upper() const { return m_upper.get(); }
-
- JSC::JSValue lowerValue(ScriptExecutionContext&) const;
- JSC::JSValue upperValue(ScriptExecutionContext&) const;
bool lowerOpen() const { return m_isLowerOpen; }
bool upperOpen() const { return m_isUpperOpen; }
static RefPtr<IDBKeyRange> only(RefPtr<IDBKey>&& value, ExceptionCode&);
- static RefPtr<IDBKeyRange> only(ScriptExecutionContext&, JSC::JSValue key, ExceptionCode&);
+ static RefPtr<IDBKeyRange> only(JSC::ExecState&, JSC::JSValue key, ExceptionCode&);
- static RefPtr<IDBKeyRange> lowerBound(ScriptExecutionContext&, JSC::JSValue bound, ExceptionCode&);
- static RefPtr<IDBKeyRange> lowerBound(ScriptExecutionContext&, JSC::JSValue bound, bool open, ExceptionCode&);
+ static RefPtr<IDBKeyRange> lowerBound(JSC::ExecState&, JSC::JSValue bound, ExceptionCode&);
+ static RefPtr<IDBKeyRange> lowerBound(JSC::ExecState&, JSC::JSValue bound, bool open, ExceptionCode&);
- static RefPtr<IDBKeyRange> upperBound(ScriptExecutionContext&, JSC::JSValue bound, ExceptionCode&);
- static RefPtr<IDBKeyRange> upperBound(ScriptExecutionContext&, JSC::JSValue bound, bool open, ExceptionCode&);
+ static RefPtr<IDBKeyRange> upperBound(JSC::ExecState&, JSC::JSValue bound, ExceptionCode&);
+ static RefPtr<IDBKeyRange> upperBound(JSC::ExecState&, JSC::JSValue bound, bool open, ExceptionCode&);
- static RefPtr<IDBKeyRange> bound(ScriptExecutionContext&, JSC::JSValue lower, JSC::JSValue upper, ExceptionCode&);
- static RefPtr<IDBKeyRange> bound(ScriptExecutionContext&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, ExceptionCode&);
- static RefPtr<IDBKeyRange> bound(ScriptExecutionContext&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, bool upperOpen, ExceptionCode&);
+ static RefPtr<IDBKeyRange> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, ExceptionCode&);
+ static RefPtr<IDBKeyRange> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, ExceptionCode&);
+ static RefPtr<IDBKeyRange> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, bool upperOpen, ExceptionCode&);
+ // FIXME: Eventually should probably change all callers to call the ExecState version.
+ static RefPtr<IDBKeyRange> only(ScriptExecutionContext&, JSC::JSValue key, ExceptionCode&);
+
WEBCORE_EXPORT bool isOnlyKey() const;
private:
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl (199703 => 199704)
--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl 2016-04-19 02:58:44 UTC (rev 199704)
@@ -28,14 +28,13 @@
ImplementationLacksVTable,
EnabledAtRuntime=IndexedDB,
] interface IDBKeyRange {
- [ImplementedAs=lowerValue, CallWith=ScriptExecutionContext, ImplementationReturnType=JSValue] readonly attribute any lower;
- [ImplementedAs=upperValue, CallWith=ScriptExecutionContext, ImplementationReturnType=JSValue] readonly attribute any upper;
+ [ImplementationReturnType=IDBKey] readonly attribute any lower;
+ [ImplementationReturnType=IDBKey] readonly attribute any upper;
readonly attribute boolean lowerOpen;
readonly attribute boolean upperOpen;
- [CallWith=ScriptExecutionContext, RaisesException] static IDBKeyRange only(any value);
- [CallWith=ScriptExecutionContext, RaisesException] static IDBKeyRange lowerBound(any lower, optional boolean open);
- [CallWith=ScriptExecutionContext, RaisesException] static IDBKeyRange upperBound(any upper, optional boolean open);
- [CallWith=ScriptExecutionContext, RaisesException] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen, optional boolean upperOpen);
+ [CallWith=ScriptState, RaisesException] static IDBKeyRange only(any value);
+ [CallWith=ScriptState, RaisesException] static IDBKeyRange lowerBound(any lower, optional boolean open);
+ [CallWith=ScriptState, RaisesException] static IDBKeyRange upperBound(any upper, optional boolean open);
+ [CallWith=ScriptState, RaisesException] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen, optional boolean upperOpen);
};
-
Modified: trunk/Source/WebCore/Modules/streams/ReadableStreamSource.h (199703 => 199704)
--- trunk/Source/WebCore/Modules/streams/ReadableStreamSource.h 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/Modules/streams/ReadableStreamSource.h 2016-04-19 02:58:44 UTC (rev 199704)
@@ -34,13 +34,8 @@
#include "JSDOMPromise.h"
#include "ReadableStreamController.h"
-#include <runtime/ArrayBuffer.h>
#include <wtf/Optional.h>
-namespace Deprecated {
-class ScriptValue;
-}
-
namespace WebCore {
typedef int ExceptionCode;
@@ -52,7 +47,7 @@
typedef DOMPromise<std::nullptr_t, ExceptionCode> Promise;
void start(ReadableStreamController&&, Promise&&);
- void cancel(const Deprecated::ScriptValue&);
+ void cancel(JSC::JSValue);
bool isStarting() const { return !!m_startPromise; }
@@ -72,7 +67,6 @@
private:
Optional<Promise> m_startPromise;
-
Optional<ReadableStreamController> m_controller;
};
@@ -92,7 +86,7 @@
setInactive();
}
-inline void ReadableStreamSource::cancel(const Deprecated::ScriptValue&)
+inline void ReadableStreamSource::cancel(JSC::JSValue)
{
clean();
doCancel();
Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp (199703 => 199704)
--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp 2016-04-19 02:58:44 UTC (rev 199704)
@@ -80,32 +80,29 @@
return true;
}
-static JSValue idbKeyToJSValue(ExecState* exec, JSGlobalObject* globalObject, IDBKey* key)
+JSValue toJS(ExecState& state, JSGlobalObject& globalObject, IDBKey* key)
{
- if (!key || !exec) {
- // This should be undefined, not null.
+ if (!key) {
+ // This must be undefined, not null.
// Spec: http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBKeyRange
return jsUndefined();
}
- Locker<JSLock> locker(exec->vm().apiLock());
+ Locker<JSLock> locker(state.vm().apiLock());
switch (key->type()) {
- case KeyType::Array:
- {
- const Vector<RefPtr<IDBKey>>& inArray = key->array();
- size_t size = inArray.size();
- JSArray* outArray = constructEmptyArray(exec, 0, globalObject, size);
- for (size_t i = 0; i < size; ++i) {
- IDBKey* arrayKey = inArray.at(i).get();
- outArray->putDirectIndex(exec, i, idbKeyToJSValue(exec, globalObject, arrayKey));
- }
- return JSValue(outArray);
- }
+ case KeyType::Array: {
+ auto& inArray = key->array();
+ unsigned size = inArray.size();
+ auto& outArray = *constructEmptyArray(&state, 0, &globalObject, size);
+ for (size_t i = 0; i < size; ++i)
+ outArray.putDirectIndex(&state, i, toJS(state, globalObject, inArray.at(i).get()));
+ return &outArray;
+ }
case KeyType::String:
- return jsStringWithCache(exec, key->string());
+ return jsStringWithCache(&state, key->string());
case KeyType::Date:
- return jsDateOrNull(exec, key->date());
+ return jsDateOrNull(&state, key->date());
case KeyType::Number:
return jsNumber(key->number());
case KeyType::Min:
@@ -261,7 +258,7 @@
if (!key)
return false;
- if (!set(&exec, parent, keyPathElements.last(), idbKeyToJSValue(&exec, exec.lexicalGlobalObject(), key.get())))
+ if (!set(&exec, parent, keyPathElements.last(), toJS(exec, *exec.lexicalGlobalObject(), key.get())))
return false;
return true;
@@ -362,7 +359,7 @@
if (!exec)
return { };
- return idbKeyToJSValue(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), key.get());
+ return toJS(*exec, *exec->lexicalGlobalObject(), key.get());
}
static Vector<IDBKeyData> createKeyPathArray(ExecState& exec, JSValue value, const IDBIndexInfo& info)
Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h (199703 => 199704)
--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h 2016-04-19 02:58:44 UTC (rev 199704)
@@ -32,6 +32,7 @@
namespace JSC {
class ExecState;
+class JSGlobalObject;
class JSValue;
}
@@ -54,6 +55,7 @@
bool canInjectIDBKeyIntoScriptValue(JSC::ExecState&, const JSC::JSValue&, const IDBKeyPath&);
bool injectIDBKeyIntoScriptValue(JSC::ExecState&, const IDBKeyData&, JSC::JSValue, const IDBKeyPath&);
+JSC::JSValue toJS(JSC::ExecState&, JSC::JSGlobalObject&, IDBKey*);
JSC::JSValue idbKeyDataToScriptValue(ScriptExecutionContext&, const IDBKeyData&);
void generateIndexKeyForValue(JSC::ExecState&, const IDBIndexInfo&, JSC::JSValue, IndexKey& outKey);
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (199703 => 199704)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-19 02:33:24 UTC (rev 199703)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-19 02:58:44 UTC (rev 199704)
@@ -4061,7 +4061,7 @@
"SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
"Date" => "double",
"Dictionary" => "Dictionary",
- "any" => "Deprecated::ScriptValue",
+ "any" => "JSC::JSValue",
"boolean" => "bool",
"double" => "double",
"float" => "float",
@@ -4213,8 +4213,7 @@
}
if ($type eq "any") {
- AddToImplIncludes("<bindings/ScriptValue.h>");
- return "{ state->vm(), $value }";
+ return $value;
}
if ($type eq "NodeFilter") {
@@ -4351,17 +4350,13 @@
if ($type eq "any") {
my $returnType = $signature->extendedAttributes->{"ImplementationReturnType"};
- if ($interfaceName eq "Document") {
- AddToImplIncludes("JSCanvasRenderingContext2D.h", $conditional);
- } elsif (defined $returnType and $returnType eq "JSValue") {
- return "$value";
- } elsif (defined $returnType and $returnType eq "IDBKeyPath") {
+ if (defined $returnType and ($returnType eq "IDBKeyPath" or $returnType eq "IDBKey")) {
AddToImplIncludes("IDBBindingUtilities.h", $conditional);
return "toJS(*state, *$globalObject, $value)";
} else {
- return "($value.hasNoValue() ? jsNull() : $value.jsValue())";
+ return $value;
}
- } elsif ($type eq "SerializedScriptValue" or $type eq "any") {
+ } elsif ($type eq "SerializedScriptValue") {
AddToImplIncludes("SerializedScriptValue.h", $conditional);
return "$value ? $value->deserialize(state, castedThis->globalObject(), 0) : jsNull()";
} elsif ($codeGenerator->IsTypedArrayType($type)) {