Title: [200242] trunk/Source/WebCore
Revision
200242
Author
[email protected]
Date
2016-04-29 09:08:00 -0700 (Fri, 29 Apr 2016)

Log Message

[Web IDL] Drop 'any' type handling from CanUseWTFOptionalForParameter()
https://bugs.webkit.org/show_bug.cgi?id=157152

Reviewed by Darin Adler.

Drop 'any' type handling from CanUseWTFOptionalForParameter(). Always
use undefined as default value for parameters of type 'any' unless
specified otherwise.

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::continueFunction): Deleted.
* Modules/indexeddb/IDBCursor.h:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::add): Deleted.
(WebCore::IDBObjectStore::putOrAdd): Deleted.
* Modules/indexeddb/IDBObjectStore.h:
* bindings/scripts/CodeGeneratorJS.pm:

(WillConvertUndefinedToDefaultParameterValue):
Fix optimization for optional DOMString attributes whose default value
is the string "undefined". I also added bindings test coverage for it.

(GenerateParametersCheck):
(CanUseWTFOptionalForParameter): Deleted.
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
(webkit_dom_test_obj_method_with_optional_string_is_undefined):
(webkit_dom_test_obj_method_with_optional_any):
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAny):
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
(-[DOMTestObj methodWithOptionalStringIsUndefined:]):
(-[DOMTestObj methodWithOptionalAny:]):
* bindings/scripts/test/TestObj.idl:
* testing/Internals.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200241 => 200242)


--- trunk/Source/WebCore/ChangeLog	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/ChangeLog	2016-04-29 16:08:00 UTC (rev 200242)
@@ -1,3 +1,43 @@
+2016-04-29  Chris Dumez  <[email protected]>
+
+        [Web IDL] Drop 'any' type handling from CanUseWTFOptionalForParameter()
+        https://bugs.webkit.org/show_bug.cgi?id=157152
+
+        Reviewed by Darin Adler.
+
+        Drop 'any' type handling from CanUseWTFOptionalForParameter(). Always
+        use undefined as default value for parameters of type 'any' unless
+        specified otherwise.
+
+        * Modules/indexeddb/IDBCursor.cpp:
+        (WebCore::IDBCursor::continueFunction): Deleted.
+        * Modules/indexeddb/IDBCursor.h:
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::add): Deleted.
+        (WebCore::IDBObjectStore::putOrAdd): Deleted.
+        * Modules/indexeddb/IDBObjectStore.h:
+        * bindings/scripts/CodeGeneratorJS.pm:
+
+        (WillConvertUndefinedToDefaultParameterValue):
+        Fix optimization for optional DOMString attributes whose default value
+        is the string "undefined". I also added bindings test coverage for it.
+
+        (GenerateParametersCheck):
+        (CanUseWTFOptionalForParameter): Deleted.
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        (webkit_dom_test_obj_method_with_optional_string_is_undefined):
+        (webkit_dom_test_obj_method_with_optional_any):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalAny):
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        (-[DOMTestObj methodWithOptionalStringIsUndefined:]):
+        (-[DOMTestObj methodWithOptionalAny:]):
+        * bindings/scripts/test/TestObj.idl:
+        * testing/Internals.h:
+
 2016-04-29  Joanmarie Diggs  <[email protected]>
 
         AX: [ATK] Expose elements with ARIA's "text" role

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (200241 => 200242)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp	2016-04-29 16:08:00 UTC (rev 200242)
@@ -255,11 +255,6 @@
     uncheckedIterateCursor(IDBKeyData(), count);
 }
 
-void IDBCursor::continueFunction(ScriptExecutionContext&, ExceptionCodeWithMessage& ec)
-{
-    continueFunction(IDBKeyData(), ec);
-}
-
 void IDBCursor::continueFunction(ScriptExecutionContext& context, JSValue keyValue, ExceptionCodeWithMessage& ec)
 {
     RefPtr<IDBKey> key;

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h (200241 => 200242)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h	2016-04-29 16:08:00 UTC (rev 200242)
@@ -64,7 +64,6 @@
 
     RefPtr<IDBRequest> update(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&);
     void advance(unsigned, ExceptionCodeWithMessage&);
-    void continueFunction(ScriptExecutionContext&, ExceptionCodeWithMessage&);
     void continueFunction(ScriptExecutionContext&, JSC::JSValue key, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> deleteFunction(ScriptExecutionContext&, ExceptionCodeWithMessage&);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (200241 => 200242)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2016-04-29 16:08:00 UTC (rev 200242)
@@ -203,11 +203,6 @@
     return WTFMove(request);
 }
 
-RefPtr<IDBRequest> IDBObjectStore::add(ExecState& state, JSValue value, ExceptionCodeWithMessage& ec)
-{
-    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, InlineKeyCheck::Perform, ec);
-}
-
 RefPtr<IDBRequest> IDBObjectStore::add(ExecState& execState, JSValue value, JSValue key, ExceptionCodeWithMessage& ec)
 {
     RefPtr<IDBKey> idbKey;
@@ -224,11 +219,6 @@
     return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
 }
 
-RefPtr<IDBRequest> IDBObjectStore::put(ExecState& state, JSValue value, ExceptionCodeWithMessage& ec)
-{
-    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::Overwrite, InlineKeyCheck::Perform, ec);
-}
-
 RefPtr<IDBRequest> IDBObjectStore::putForCursorUpdate(ExecState& state, JSValue value, JSValue key, ExceptionCodeWithMessage& ec)
 {
     return putOrAdd(state, value, scriptValueToIDBKey(state, key), IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor, InlineKeyCheck::DoNotPerform, ec);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (200241 => 200242)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2016-04-29 16:08:00 UTC (rev 200242)
@@ -62,8 +62,6 @@
     RefPtr<IDBTransaction> transaction();
     bool autoIncrement() const;
 
-    RefPtr<IDBRequest> add(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&);
-    RefPtr<IDBRequest> put(JSC::ExecState&, JSC::JSValue, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, JSC::JSValue key, const String& direction, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> get(ScriptExecutionContext&, JSC::JSValue key, ExceptionCodeWithMessage&);

Modified: trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp (200241 => 200242)


--- trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp	2016-04-29 16:08:00 UTC (rev 200242)
@@ -66,19 +66,7 @@
 
     ExceptionCodeWithMessage ec;
     auto value = state.uncheckedArgument(0);
-
-    if (argsCount == 1) {
-        JSValue result;
-        if (overwrite)
-            result = toJS(&state, castedThis->globalObject(), wrapped.put(state, value, ec).get());
-        else
-            result = toJS(&state, castedThis->globalObject(), wrapped.add(state, value, ec).get());
-
-        setDOMException(&state, ec);
-        return result;
-    }
-
-    auto key = state.uncheckedArgument(1);
+    auto key = state.argument(1);
     JSValue result;
     if (overwrite)
         result = toJS(&state, castedThis->globalObject(), wrapped.put(state, value, key, ec).get());

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200241 => 200242)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-29 16:08:00 UTC (rev 200242)
@@ -3381,7 +3381,6 @@
     return 0 if $codeGenerator->IsCallbackInterface($type);
     return 0 if $codeGenerator->IsEnumType($type);
     return 0 if $codeGenerator->IsWrapperType($type);
-    return 0 if $type eq "any";
 
     return 1;
 }
@@ -3400,8 +3399,10 @@
     }
 
     # toString() will convert undefined to the string "undefined";
-    return 1 if $parameterType eq "DOMString" and $defaultValue eq "undefined";
+    return 1 if $parameterType eq "DOMString" and $defaultValue eq "\"undefined\"";
 
+    return 1 if $parameterType eq "any" and $defaultValue eq "undefined";
+
     # JSValue::toBoolean() will convert undefined to false.
     return 1 if $parameterType eq "boolean" and $defaultValue eq "false";
 
@@ -3474,6 +3475,9 @@
         # We use the null string as default value for non-nullable parameters of type DOMString unless specified otherwise.
         $parameter->default("null") if ($optional && !defined($parameter->default) && $argType eq "DOMString" && !$parameter->isNullable);
 
+        # We use undefined as default value for optional parameters of type 'any' unless specified otherwise.
+        $parameter->default("undefined") if ($optional && !defined($parameter->default) && $argType eq "any");
+
         # FIXME: We should eventually stop generating any early calls, and instead use either default parameter values or WTF::Optional<>.
         if ($optional && !defined($parameter->default) && !CanUseWTFOptionalForParameter($parameter) && !$codeGenerator->IsCallbackInterface($argType)) {
             # Generate early call if there are enough parameters.
@@ -3643,6 +3647,7 @@
                         $defaultValue = "nullptr" if $defaultValue eq "null";
                         $defaultValue = "PNaN" if $defaultValue eq "NaN";
                         $defaultValue = "$nativeType()" if $defaultValue eq "[]";
+                        $defaultValue = "JSValue::JSUndefined" if $defaultValue eq "undefined";
                     }
 
                     $outer = "state->argument($argsIndex).isUndefined() ? $defaultValue : ";

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (200241 => 200242)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2016-04-29 16:08:00 UTC (rev 200242)
@@ -1636,6 +1636,16 @@
     item->methodWithOptionalStringIsNull(convertedStr);
 }
 
+void webkit_dom_test_obj_method_with_optional_string_is_undefined(WebKitDOMTestObj* self, const gchar* str)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    g_return_if_fail(str);
+    WebCore::TestObj* item = WebKit::core(self);
+    WTF::String convertedStr = WTF::String::fromUTF8(str);
+    item->methodWithOptionalStringIsUndefined(convertedStr);
+}
+
 void webkit_dom_test_obj_method_with_optional_atomic_string_is_null(WebKitDOMTestObj* self, const gchar* str)
 {
     WebCore::JSMainThreadNullState state;
@@ -1750,6 +1760,16 @@
     item->methodWithOptionalBooleanIsFalse(b);
 }
 
+void webkit_dom_test_obj_method_with_optional_any(WebKitDOMTestObj* self, WebKitDOMany* a)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    g_return_if_fail(WEBKIT_DOM_IS_ANY(a));
+    WebCore::TestObj* item = WebKit::core(self);
+    WebCore::any* convertedA = WebKit::core(a);
+    item->methodWithOptionalAny(convertedA);
+}
+
 gchar* webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self)
 {
 #if ENABLE(Condition1)

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (200241 => 200242)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2016-04-29 16:08:00 UTC (rev 200242)
@@ -559,6 +559,16 @@
 webkit_dom_test_obj_method_with_optional_string_is_null(WebKitDOMTestObj* self, const gchar* str);
 
 /**
+ * webkit_dom_test_obj_method_with_optional_string_is_undefined:
+ * @self: A #WebKitDOMTestObj
+ * @str: A #gchar
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_string_is_undefined(WebKitDOMTestObj* self, const gchar* str);
+
+/**
  * webkit_dom_test_obj_method_with_optional_atomic_string_is_null:
  * @self: A #WebKitDOMTestObj
  * @str: A #gchar
@@ -689,6 +699,16 @@
 webkit_dom_test_obj_method_with_optional_boolean_is_false(WebKitDOMTestObj* self, gboolean b);
 
 /**
+ * webkit_dom_test_obj_method_with_optional_any:
+ * @self: A #WebKitDOMTestObj
+ * @a: A #WebKitDOMany
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_any(WebKitDOMTestObj* self, WebKitDOMany* a);
+
+/**
  * webkit_dom_test_obj_conditional_method1:
  * @self: A #WebKitDOMTestObj
  *

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200241 => 200242)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-04-29 16:08:00 UTC (rev 200242)
@@ -142,6 +142,7 @@
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringAndDefaultValue(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyString(JSC::ExecState*);
@@ -156,6 +157,7 @@
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBoolean(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAny(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*);
@@ -716,6 +718,7 @@
     { "methodWithOptionalStringAndDefaultValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue), (intptr_t) (0) } },
     { "methodWithOptionalAtomicStringAndDefaultValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringAndDefaultValue), (intptr_t) (0) } },
     { "methodWithOptionalStringIsNull", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull), (intptr_t) (0) } },
+    { "methodWithOptionalStringIsUndefined", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined), (intptr_t) (0) } },
     { "methodWithOptionalAtomicStringIsNull", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull), (intptr_t) (0) } },
     { "methodWithOptionalStringIsEmptyString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString), (intptr_t) (0) } },
     { "methodWithOptionalAtomicStringIsEmptyString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyString), (intptr_t) (0) } },
@@ -730,6 +733,7 @@
     { "methodWithOptionalArrayIsEmpty", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty), (intptr_t) (0) } },
     { "methodWithOptionalBoolean", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalBoolean), (intptr_t) (0) } },
     { "methodWithOptionalBooleanIsFalse", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse), (intptr_t) (0) } },
+    { "methodWithOptionalAny", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalAny), (intptr_t) (0) } },
     { "methodWithCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) } },
     { "methodWithNonCallbackArgAndCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t) (2) } },
     { "methodWithCallbackAndOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t) (0) } },
@@ -4199,6 +4203,21 @@
     return JSValue::encode(jsUndefined());
 }
 
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined(ExecState* state)
+{
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringIsUndefined");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->wrapped();
+    String str = state->argument(0).toString(state)->value(state);
+    if (UNLIKELY(state->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.methodWithOptionalStringIsUndefined(str);
+    return JSValue::encode(jsUndefined());
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
@@ -4409,6 +4428,21 @@
     return JSValue::encode(jsUndefined());
 }
 
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAny(ExecState* state)
+{
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, "TestObj", "methodWithOptionalAny");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->wrapped();
+    JSC::JSValue a = state->argument(0);
+    if (UNLIKELY(state->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.methodWithOptionalAny(a);
+    return JSValue::encode(jsUndefined());
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* state)
 {
     JSValue thisValue = state->thisValue();

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (200241 => 200242)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2016-04-29 16:08:00 UTC (rev 200242)
@@ -181,6 +181,7 @@
 - (void)methodWithOptionalStringAndDefaultValue:(NSString *)str;
 - (void)methodWithOptionalAtomicStringAndDefaultValue:(NSString *)str;
 - (void)methodWithOptionalStringIsNull:(NSString *)str;
+- (void)methodWithOptionalStringIsUndefined:(NSString *)str;
 - (void)methodWithOptionalAtomicStringIsNull:(NSString *)str;
 - (void)methodWithOptionalStringIsEmptyString:(NSString *)str;
 - (void)methodWithOptionalAtomicStringIsEmptyString:(NSString *)str;
@@ -192,6 +193,7 @@
 - (void)methodWithOptionalUnsignedLongLongIsZero:(unsigned long long)number;
 - (void)methodWithOptionalBoolean:(BOOL)b;
 - (void)methodWithOptionalBooleanIsFalse:(BOOL)b;
+- (void)methodWithOptionalAny:(DOMany *)a;
 - (void)classMethod;
 - (int)classMethodWithOptional:(int)arg;
 - (void)classMethod2:(int)arg;

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (200241 => 200242)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2016-04-29 16:08:00 UTC (rev 200242)
@@ -1310,6 +1310,12 @@
     IMPL->methodWithOptionalStringIsNull(str);
 }
 
+- (void)methodWithOptionalStringIsUndefined:(NSString *)str
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->methodWithOptionalStringIsUndefined(str);
+}
+
 - (void)methodWithOptionalAtomicStringIsNull:(NSString *)str
 {
     WebCore::JSMainThreadNullState state;
@@ -1376,7 +1382,13 @@
     IMPL->methodWithOptionalBooleanIsFalse(b);
 }
 
+- (void)methodWithOptionalAny:(DOMany *)a
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->methodWithOptionalAny(core(a));
+}
 
+
 #if ENABLE(Condition1)
 - (NSString *)conditionalMethod1
 {

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (200241 => 200242)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-04-29 16:08:00 UTC (rev 200242)
@@ -185,6 +185,7 @@
     void    methodWithOptionalStringAndDefaultValue(optional DOMString str = "foo");
     void    methodWithOptionalAtomicStringAndDefaultValue([AtomicString] optional DOMString str = "foo");
     void    methodWithOptionalStringIsNull(optional DOMString str = null);
+    void    methodWithOptionalStringIsUndefined(optional DOMString str = "undefined");
     void    methodWithOptionalAtomicStringIsNull([AtomicString] optional DOMString str = null);
     void    methodWithOptionalStringIsEmptyString(optional DOMString str = "");
     void    methodWithOptionalAtomicStringIsEmptyString([AtomicString] optional DOMString str = "");
@@ -199,6 +200,7 @@
     void    methodWithOptionalArrayIsEmpty(optional DOMString[] array = []);
     void    methodWithOptionalBoolean(optional boolean b);
     void    methodWithOptionalBooleanIsFalse(optional boolean b = false);
+    void    methodWithOptionalAny(optional any a);
 
 #if defined(TESTING_JS)
     // Callback interface parameters.

Modified: trunk/Source/WebCore/testing/Internals.h (200241 => 200242)


--- trunk/Source/WebCore/testing/Internals.h	2016-04-29 13:10:04 UTC (rev 200241)
+++ trunk/Source/WebCore/testing/Internals.h	2016-04-29 16:08:00 UTC (rev 200242)
@@ -200,7 +200,7 @@
     RefPtr<NodeList> nodesFromRect(Document&, int x, int y, unsigned topPadding, unsigned rightPadding,
         unsigned bottomPadding, unsigned leftPadding, bool ignoreClipping, bool allowShadowContent, bool allowChildFrameContent, ExceptionCode&) const;
 
-    String parserMetaData(JSC::JSValue = { });
+    String parserMetaData(JSC::JSValue = JSC::JSValue::JSUndefined);
 
     void updateEditorUINowIfScheduled();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to