Title: [123546] trunk/Source/WebCore
Revision
123546
Author
[email protected]
Date
2012-07-24 15:55:34 -0700 (Tue, 24 Jul 2012)

Log Message

[JSBinding] Merging jsUnsignedLongArrayToVector() to toNativeArray() using traits.
https://bugs.webkit.org/show_bug.cgi?id=90381

Patch by Vineet Chaudhary <[email protected]> on 2012-07-24
Reviewed by Kentaro Hara.

We can remove jsUnsignedLongArrayToVector() implementaion
merging it to current and toNativeArray() traits.

Tests: TestObj.idl
There should be no behavoiral changes as just refactoring.

* Modules/vibration/NavigatorVibration.idl: Use sequence<T> as method param than T[]
* bindings/js/JSDOMBinding.cpp: Moved toJSSequence() to header file.
* bindings/js/JSDOMBinding.h:
(WebCore::toJSSequence): Moved toJSSequence() to header file.
(WebCore::jsArray): Renamed Traits to JSValueTraits
(WebCore::toNativeArray): Using traits.
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue):
* bindings/js/JSMessagePortCustom.cpp:
(WebCore::fillMessagePortArray):
* bindings/scripts/CodeGeneratorJS.pm: Removed unsigned long[] specific binding code.
(AddIncludesForType):
(GenerateParametersCheckExpression):
(JSValueToNative):
(NativeToJSValue):
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateParametersCheckExpression): Added check sequence<T> check for overloaded methods.
* bindings/scripts/test/JS/JSTestObj.cpp: Rebased binding test.
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
(WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence):
* bindings/scripts/test/JS/JSTestObj.h: Rebased binding test.
* bindings/scripts/test/TestObj.idl: Added test for sequence<T> as method parameter.
* bindings/scripts/test/V8/V8TestObj.cpp: Rebased binding test.
(WebCore::TestObjV8Internal::overloadedMethod10Callback):
(TestObjV8Internal):
(WebCore::TestObjV8Internal::overloadedMethodCallback):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123545 => 123546)


--- trunk/Source/WebCore/ChangeLog	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/ChangeLog	2012-07-24 22:55:34 UTC (rev 123546)
@@ -1,3 +1,44 @@
+2012-07-24  Vineet Chaudhary  <[email protected]>
+
+        [JSBinding] Merging jsUnsignedLongArrayToVector() to toNativeArray() using traits.
+        https://bugs.webkit.org/show_bug.cgi?id=90381
+
+        Reviewed by Kentaro Hara.
+
+        We can remove jsUnsignedLongArrayToVector() implementaion
+        merging it to current and toNativeArray() traits.
+
+        Tests: TestObj.idl
+        There should be no behavoiral changes as just refactoring.
+
+        * Modules/vibration/NavigatorVibration.idl: Use sequence<T> as method param than T[]
+        * bindings/js/JSDOMBinding.cpp: Moved toJSSequence() to header file.
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::toJSSequence): Moved toJSSequence() to header file.
+        (WebCore::jsArray): Renamed Traits to JSValueTraits
+        (WebCore::toNativeArray): Using traits.
+        * bindings/js/JSDictionary.cpp:
+        (WebCore::JSDictionary::convertValue):
+        * bindings/js/JSMessagePortCustom.cpp:
+        (WebCore::fillMessagePortArray):
+        * bindings/scripts/CodeGeneratorJS.pm: Removed unsigned long[] specific binding code.
+        (AddIncludesForType):
+        (GenerateParametersCheckExpression):
+        (JSValueToNative):
+        (NativeToJSValue):
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateParametersCheckExpression): Added check sequence<T> check for overloaded methods.
+        * bindings/scripts/test/JS/JSTestObj.cpp: Rebased binding test.
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence):
+        * bindings/scripts/test/JS/JSTestObj.h: Rebased binding test.
+        * bindings/scripts/test/TestObj.idl: Added test for sequence<T> as method parameter.
+        * bindings/scripts/test/V8/V8TestObj.cpp: Rebased binding test.
+        (WebCore::TestObjV8Internal::overloadedMethod10Callback):
+        (TestObjV8Internal):
+        (WebCore::TestObjV8Internal::overloadedMethodCallback):
+
 2012-07-24  Kwang Yul Seo  <[email protected]>
 
         Remove an invalid assertion introduced in r123536. Unreviewed.

Modified: trunk/Source/WebCore/Modules/vibration/NavigatorVibration.idl (123545 => 123546)


--- trunk/Source/WebCore/Modules/vibration/NavigatorVibration.idl	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/Modules/vibration/NavigatorVibration.idl	2012-07-24 22:55:34 UTC (rev 123546)
@@ -23,7 +23,7 @@
         Conditional=VIBRATION,
         Supplemental=Navigator
     ] NavigatorVibration {
-        void webkitVibrate(in unsigned long[]? pattern) raises(DOMException);
+        void webkitVibrate(in sequence<unsigned long> pattern) raises(DOMException);
         void webkitVibrate(in unsigned long time) raises(DOMException);
     };
 

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (123545 => 123546)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp	2012-07-24 22:55:34 UTC (rev 123546)
@@ -277,27 +277,4 @@
     return structures.set(classInfo, WriteBarrier<Structure>(globalObject->globalData(), globalObject, structure)).iterator->second.get();
 }
 
-JSC::JSObject* toJSSequence(ExecState* exec, JSValue value, unsigned& length)
-{
-    JSObject* object = value.getObject();
-    if (!object) {
-        throwTypeError(exec);
-        return 0;
-    }
-    JSValue lengthValue = object->get(exec, exec->propertyNames().length);
-    if (exec->hadException())
-        return 0;
-
-    if (lengthValue.isUndefinedOrNull()) {
-        throwTypeError(exec);
-        return 0;
-    }
-
-    length = lengthValue.toUInt32(exec);
-    if (exec->hadException())
-        return 0;
-
-    return object;
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (123545 => 123546)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2012-07-24 22:55:34 UTC (rev 123546)
@@ -34,6 +34,7 @@
 #include "StylePropertySet.h"
 #include "StyledElement.h"
 #include <heap/Weak.h>
+#include <runtime/Error.h>
 #include <runtime/FunctionPrototype.h>
 #include <runtime/JSArray.h>
 #include <runtime/Lookup.h>
@@ -275,6 +276,31 @@
     // NaN if the value can't be converted to a date.
     double valueToDate(JSC::ExecState*, JSC::JSValue);
 
+    // Validates that the passed object is a sequence type per section 4.1.13 of the WebIDL spec.
+    inline JSC::JSObject* toJSSequence(JSC::ExecState* exec, JSC::JSValue value, unsigned& length)
+    {
+        JSC::JSObject* object = value.getObject();
+        if (!object) {
+            throwTypeError(exec);
+            return 0;
+        }
+
+        JSC::JSValue lengthValue = object->get(exec, exec->propertyNames().length);
+        if (exec->hadException())
+            return 0;
+
+        if (lengthValue.isUndefinedOrNull()) {
+            throwTypeError(exec);
+            return 0;
+        }
+
+        length = lengthValue.toUInt32(exec);
+        if (exec->hadException())
+            return 0;
+
+        return object;
+    }
+
     template <typename T>
     inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<T> ptr)
     {
@@ -282,7 +308,7 @@
     }
 
     template <class T>
-    struct Traits {
+    struct JSValueTraits {
         static inline JSC::JSValue arrayJSValue(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const T& value)
         {
             return toJS(exec, globalObject, WTF::getPtr(value));
@@ -290,7 +316,7 @@
     };
 
     template<>
-    struct Traits<String> {
+    struct JSValueTraits<String> {
         static inline JSC::JSValue arrayJSValue(JSC::ExecState* exec, JSDOMGlobalObject*, const String& value)
         {
             return jsString(exec, stringToUString(value));
@@ -298,7 +324,7 @@
     };
 
     template<>
-    struct Traits<float> {
+    struct JSValueTraits<float> {
         static inline JSC::JSValue arrayJSValue(JSC::ExecState*, JSDOMGlobalObject*, const float& value)
         {
             return JSC::jsNumber(value);
@@ -306,7 +332,7 @@
     };
 
     template<>
-    struct Traits<unsigned long> {
+    struct JSValueTraits<unsigned long> {
         static inline JSC::JSValue arrayJSValue(JSC::ExecState*, JSDOMGlobalObject*, const unsigned long& value)
         {
             return JSC::jsNumber(value);
@@ -318,7 +344,7 @@
     {
         JSC::MarkedArgumentBuffer list;
         typename Vector<T, inlineCapacity>::const_iterator end = iterator.end();        
-        typedef Traits<T> TraitsType;
+        typedef JSValueTraits<T> TraitsType;
 
         for (typename Vector<T, inlineCapacity>::const_iterator iter = iterator.begin(); iter != end; ++iter)
             list.append(TraitsType::arrayJSValue(exec, globalObject, *iter));
@@ -328,25 +354,55 @@
 
     JSC::JSValue jsArray(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<DOMStringList>);
 
+    template<class T> struct NativeValueTraits;
+
+    template<>
+    struct NativeValueTraits<String> {
+        static inline bool arrayNativeValue(JSC::ExecState* exec, JSC::JSValue jsValue, String& indexedValue)
+        {
+            indexedValue = ustringToString(jsValue.toString(exec)->value(exec));
+            return true;
+        }
+    };
+
+    template<>
+    struct NativeValueTraits<unsigned long> {
+        static inline bool arrayNativeValue(JSC::ExecState* exec, JSC::JSValue jsValue, unsigned long& indexedValue)
+        {
+            if (!jsValue.isNumber())
+                return false;
+
+            indexedValue = jsValue.toUInt32(exec);
+            if (exec->hadException())
+                return false;
+
+            return true;
+        }
+    };
+
     template <class T>
     Vector<T> toNativeArray(JSC::ExecState* exec, JSC::JSValue value)
     {
-        if (!isJSArray(value))
-            return Vector<T>();
+        unsigned length = 0;
+        if (isJSArray(value)) {
+            JSC::JSArray* array = asArray(value);
+            length = array->length();
+        } else
+            toJSSequence(exec, value, length);
 
+        JSC::JSObject* object = value.getObject();
         Vector<T> result;
-        JSC::JSArray* array = asArray(value);
+        typedef NativeValueTraits<T> TraitsType;
 
-        for (unsigned i = 0; i < array->length(); ++i) {
-            String indexedValue = ustringToString(array->getIndex(i).toString(exec)->value(exec));
-            result.append(indexedValue);
+        for (unsigned i = 0; i < length; ++i) {
+            T indexValue;
+            if (!TraitsType::arrayNativeValue(exec, object->get(exec, i), indexValue))
+                return Vector<T>();
+            result.append(indexValue);
         }
         return result;
     }
 
-    // Validates that the passed object is a sequence type per section 4.1.13 of the WebIDL spec.
-    JSC::JSObject* toJSSequence(JSC::ExecState*, JSC::JSValue, unsigned&);
-
     // FIXME: Implement allowAccessToContext(JSC::ExecState*, ScriptExecutionContext*);
     bool shouldAllowAccessToNode(JSC::ExecState*, Node*);
     bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*);
@@ -403,23 +459,6 @@
         return AtomicString(propertyName.publicName());
     }
 
-    inline Vector<unsigned long> jsUnsignedLongArrayToVector(JSC::ExecState* exec, JSC::JSValue value)
-    {
-        unsigned length;
-        JSC::JSObject* object = toJSSequence(exec, value, length);
-        if (exec->hadException())
-            return Vector<unsigned long>();
-
-        Vector<unsigned long> result;
-        for (unsigned i = 0; i < length; i++) {
-            JSC::JSValue indexedValue;
-            indexedValue = object->get(exec, i);
-            if (exec->hadException() || indexedValue.isUndefinedOrNull() || !indexedValue.isNumber())
-                return Vector<unsigned long>();
-            result.append(indexedValue.toUInt32(exec));
-        }
-        return result;
-    }
 } // namespace WebCore
 
 #endif // JSDOMBinding_h

Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (123545 => 123546)


--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp	2012-07-24 22:55:34 UTC (rev 123546)
@@ -107,7 +107,7 @@
     if (value.isUndefinedOrNull())
         return;
 
-    unsigned length;
+    unsigned length = 0;
     JSObject* object = toJSSequence(exec, value, length);
     if (exec->hadException())
         return;
@@ -171,7 +171,7 @@
     if (value.isUndefinedOrNull())
         return;
 
-    unsigned length;
+    unsigned length = 0;
     JSObject* object = toJSSequence(exec, value, length);
     if (exec->hadException())
         return;

Modified: trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp (123545 => 123546)


--- trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp	2012-07-24 22:55:34 UTC (rev 123546)
@@ -79,7 +79,7 @@
     }
 
     // Validation of sequence types, per WebIDL spec 4.1.13.
-    unsigned length;
+    unsigned length = 0;
     JSObject* object = toJSSequence(exec, value, length);
     if (exec->hadException())
         return;

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (123545 => 123546)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2012-07-24 22:55:34 UTC (rev 123546)
@@ -260,8 +260,6 @@
     } elsif ($type eq "DOMString[]") {
         # FIXME: Add proper support for T[], T[]?, sequence<T>
         $includesRef->{"JSDOMStringList.h"} = 1;
-    } elsif ($type eq "unsigned long[]") {
-        $includesRef->{"<wtf/Vector.h>"} = 1;
     } elsif ($type eq "SerializedScriptValue") {
         $includesRef->{"SerializedScriptValue.h"} = 1;
     } elsif ($isCallback) {
@@ -1277,7 +1275,7 @@
             # For Callbacks only checks if the value is null or object.
             push(@andExpression, "(${value}.isNull() || ${value}.isFunction())");
             $usedArguments{$parameterIndex} = 1;
-        } elsif (IsArrayType($type)) {
+        } elsif (IsArrayType($type) || $codeGenerator->GetSequenceType($type)) {
             # FIXME: Add proper support for T[], T[]?, sequence<T>
             if ($parameter->isNullable) {
                 push(@andExpression, "(${value}.isNull() || (${value}.isObject() && isJSArray(${value})))");
@@ -2924,8 +2922,7 @@
     "long long" => "long long",
     "unsigned long long" => "unsigned long long",
     "MediaQueryListListener" => "RefPtr<MediaQueryListListener>",
-    "DOMTimeStamp" => "DOMTimeStamp",
-    "unsigned long[]" => "Vector<unsigned long>"
+    "DOMTimeStamp" => "DOMTimeStamp",    
 );
 
 sub GetNativeType
@@ -3072,11 +3069,6 @@
         return "toDOMStringList(exec, $value)";
     }
 
-    if ($type eq "unsigned long[]") {
-        AddToImplIncludes("JSDOMBinding.h", $conditional);
-        return "jsUnsignedLongArrayToVector(exec, $value)";
-    }
-
     AddToImplIncludes("HTMLOptionElement.h", $conditional) if $type eq "HTMLOptionElement";
     AddToImplIncludes("JSCustomVoidCallback.h", $conditional) if $type eq "VoidCallback";
     AddToImplIncludes("Event.h", $conditional) if $type eq "Event";
@@ -3187,8 +3179,6 @@
     } elsif ($type eq "SerializedScriptValue" or $type eq "any") {
         AddToImplIncludes("SerializedScriptValue.h", $conditional);
         return "$value ? $value->deserialize(exec, castedThis->globalObject(), 0) : jsNull()";
-    } elsif ($type eq "unsigned long[]") {
-        AddToImplIncludes("<wrt/Vector.h>", $conditional);
     } elsif ($type eq "MessagePortArray") {
         AddToImplIncludes("MessagePort.h", $conditional);
         AddToImplIncludes("JSMessagePort.h", $conditional);

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (123545 => 123546)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-07-24 22:55:34 UTC (rev 123546)
@@ -1367,7 +1367,7 @@
         } elsif ($parameter->extendedAttributes->{"Callback"}) {
             # For Callbacks only checks if the value is null or object.
             push(@andExpression, "(${value}->IsNull() || ${value}->IsFunction())");
-        } elsif (IsArrayType($type)) {
+        } elsif (IsArrayType($type) || $codeGenerator->GetSequenceType($type)) {
             # FIXME: Add proper support for T[], T[]?, sequence<T>.
             if ($parameter->isNullable) {
                 push(@andExpression, "(${value}->IsNull() || ${value}->IsArray())");

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2012-07-24 22:55:34 UTC (rev 123546)
@@ -305,7 +305,7 @@
     { "conditionalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod3), (intptr_t)0, NoIntrinsic },
 #endif
     { "overloadedMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2, NoIntrinsic },
-    { "methodWithUnsignedLongArray", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithUnsignedLongArray), (intptr_t)1, NoIntrinsic },
+    { "methodWithUnsignedLongSequence", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence), (intptr_t)1, NoIntrinsic },
     { "stringArrayFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionStringArrayFunction), (intptr_t)1, NoIntrinsic },
     { "getSVGDocument", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionGetSVGDocument), (intptr_t)0, NoIntrinsic },
     { "convert1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConvert1), (intptr_t)1, NoIntrinsic },
@@ -2221,6 +2221,23 @@
     return JSValue::encode(jsUndefined());
 }
 
+static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod10(ExecState* exec)
+{
+    JSValue thisValue = exec->hostThisValue();
+    if (!thisValue.inherits(&JSTestObj::s_info))
+        return throwVMTypeError(exec);
+    JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue));
+    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info);
+    TestObj* impl = static_cast<TestObj*>(castedThis->impl());
+    if (exec->argumentCount() < 1)
+        return throwVMError(exec, createNotEnoughArgumentsError(exec));
+    Vector<unsigned long> arrayArg(toNativeArray<unsigned long>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+    impl->overloadedMethod(arrayArg);
+    return JSValue::encode(jsUndefined());
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec)
 {
     size_t argsCount = exec->argumentCount();
@@ -2244,6 +2261,8 @@
         return jsTestObjPrototypeFunctionOverloadedMethod8(exec);
     if ((argsCount == 1 && (arg0.isObject() && isJSArray(arg0))))
         return jsTestObjPrototypeFunctionOverloadedMethod9(exec);
+    if ((argsCount == 1 && (arg0.isObject() && isJSArray(arg0))))
+        return jsTestObjPrototypeFunctionOverloadedMethod10(exec);
     return throwVMTypeError(exec);
 }
 
@@ -2317,7 +2336,7 @@
 
 #endif
 
-EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongArray(ExecState* exec)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence(ExecState* exec)
 {
     JSValue thisValue = exec->hostThisValue();
     if (!thisValue.inherits(&JSTestObj::s_info))
@@ -2327,10 +2346,10 @@
     TestObj* impl = static_cast<TestObj*>(castedThis->impl());
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createNotEnoughArgumentsError(exec));
-    Vector<unsigned long> unsignedLongArray(jsUnsignedLongArrayToVector(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
+    Vector<unsigned long> unsignedLongSequence(toNativeArray<unsigned long>(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
-    impl->methodWithUnsignedLongArray(unsignedLongArray);
+    impl->methodWithUnsignedLongSequence(unsignedLongSequence);
     return JSValue::encode(jsUndefined());
 }
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (123545 => 123546)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2012-07-24 22:55:34 UTC (rev 123546)
@@ -203,7 +203,7 @@
 #if ENABLE(Condition1)
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(JSC::ExecState*);
 #endif
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongArray(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStringArrayFunction(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert1(JSC::ExecState*);

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


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2012-07-24 22:55:34 UTC (rev 123546)
@@ -176,6 +176,7 @@
         void    overloadedMethod(in DOMString[]? arrayArg);
         void    overloadedMethod(in TestObj objArg);
         void    overloadedMethod(in DOMString[] arrayArg);
+        void    overloadedMethod(in sequence<unsigned long> arrayArg);
 #endif
 
         // Class methods within _javascript_ (like what's used for IDBKeyRange).
@@ -207,7 +208,7 @@
 #endif
 
 #if defined(TESTING_JS)
-        void methodWithUnsignedLongArray(in unsigned long[] unsignedLongArray);
+        void methodWithUnsignedLongSequence(in sequence<unsigned long> unsignedLongSequence);
 #endif
 #if defined(TESTING_V8) || defined(TESTING_JS)
         DOMString[] stringArrayFunction(in DOMString[] values) raises(DOMException);

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (123545 => 123546)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2012-07-24 22:54:03 UTC (rev 123545)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2012-07-24 22:55:34 UTC (rev 123546)
@@ -1626,6 +1626,17 @@
     return v8::Handle<v8::Value>();
 }
 
+static v8::Handle<v8::Value> overloadedMethod10Callback(const v8::Arguments& args)
+{
+    INC_STATS("DOM.TestObj.overloadedMethod10");
+    if (args.Length() < 1)
+        return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());
+    TestObj* imp = V8TestObj::toNative(args.Holder());
+    EXCEPTION_BLOCK(Vector<unsigned long>, arrayArg, toNativeArray<unsigned long>(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
+    imp->overloadedMethod(arrayArg);
+    return v8::Handle<v8::Value>();
+}
+
 static v8::Handle<v8::Value> overloadedMethodCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.TestObj.overloadedMethod");
@@ -1647,6 +1658,8 @@
         return overloadedMethod8Callback(args);
     if ((args.Length() == 1 && (args[0]->IsArray())))
         return overloadedMethod9Callback(args);
+    if ((args.Length() == 1 && (args[0]->IsArray())))
+        return overloadedMethod10Callback(args);
     return V8Proxy::throwTypeError(0, args.GetIsolate());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to