Title: [171181] trunk/Source/WebCore
Revision
171181
Author
[email protected]
Date
2014-07-17 02:29:49 -0700 (Thu, 17 Jul 2014)

Log Message

[GObject] StrictTypeChecking extended attribute fails for methods with sequence<T>.
https://bugs.webkit.org/show_bug.cgi?id=121698

Patch by Vineet Chaudhary <[email protected]> on 2014-07-17
Reviewed by Antonio Gomes.

GodeGenerator was including wrong heeaders as WebKitDOMlong[] for methods with
array parameters and StrictTypeChecking extended attribute.
No new tests. TestObj.idl covers the tests.

* bindings/scripts/CodeGenerator.pm:
(GetArrayOrSequenceType):
* bindings/scripts/CodeGeneratorGObject.pm:
(GenerateFunction):
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
(webkit_dom_test_obj_strict_function_with_array):
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp:
(webkit_dom_test_typedefs_func):
(webkit_dom_test_typedefs_nullable_array_arg):
* bindings/scripts/test/GObject/WebKitDOMTestTypedefs.h:
* bindings/scripts/test/TestObj.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (171180 => 171181)


--- trunk/Source/WebCore/ChangeLog	2014-07-17 08:13:18 UTC (rev 171180)
+++ trunk/Source/WebCore/ChangeLog	2014-07-17 09:29:49 UTC (rev 171181)
@@ -1,3 +1,27 @@
+2014-07-17  Vineet Chaudhary  <[email protected]>
+
+        [GObject] StrictTypeChecking extended attribute fails for methods with sequence<T>.
+        https://bugs.webkit.org/show_bug.cgi?id=121698
+
+        Reviewed by Antonio Gomes.
+
+        GodeGenerator was including wrong heeaders as WebKitDOMlong[] for methods with
+        array parameters and StrictTypeChecking extended attribute.
+        No new tests. TestObj.idl covers the tests.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (GetArrayOrSequenceType):
+        * bindings/scripts/CodeGeneratorGObject.pm:
+        (GenerateFunction):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        (webkit_dom_test_obj_strict_function_with_array):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp:
+        (webkit_dom_test_typedefs_func):
+        (webkit_dom_test_typedefs_nullable_array_arg):
+        * bindings/scripts/test/GObject/WebKitDOMTestTypedefs.h:
+        * bindings/scripts/test/TestObj.idl:
+
 2014-07-17  Yusuke Suzuki  <[email protected]>
 
         CSS JIT: Clean up return path

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (171180 => 171181)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2014-07-17 08:13:18 UTC (rev 171180)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2014-07-17 09:29:49 UTC (rev 171181)
@@ -450,6 +450,14 @@
     return "";
 }
 
+sub GetArrayOrSequenceType
+{
+    my $object = shift;
+    my $type = shift;
+
+    return $object->GetArrayType($type) || $object->GetSequenceType($type);
+}
+
 sub AssertNotSequenceType
 {
     my $object = shift;

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm (171180 => 171181)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2014-07-17 08:13:18 UTC (rev 171180)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm	2014-07-17 09:29:49 UTC (rev 171181)
@@ -968,6 +968,8 @@
     my @callImplParams;
     foreach my $param (@{$function->parameters}) {
         my $paramIDLType = $param->type;
+        my $arrayOrSequenceType = $codeGenerator->GetArrayOrSequenceType($paramIDLType);
+        $paramIDLType = $arrayOrSequenceType if $arrayOrSequenceType ne "";
         my $paramType = GetGlibTypeName($paramIDLType);
         my $const = $paramType eq "gchar*" ? "const " : "";
         my $paramName = $param->name;
@@ -1011,7 +1013,10 @@
     push(@functionHeader, " * \@self: A #${className}");
 
     foreach my $param (@{$function->parameters}) {
-        my $paramType = GetGlibTypeName($param->type);
+        my $paramIDLType = $param->type;
+        my $arrayOrSequenceType = $codeGenerator->GetArrayOrSequenceType($paramIDLType);
+        $paramIDLType = $arrayOrSequenceType if $arrayOrSequenceType ne "";
+        my $paramType = GetGlibTypeName($paramIDLType);
         # $paramType can have a trailing * in some cases
         $paramType =~ s/\*$//;
         my $paramName = $param->name;

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


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2014-07-17 08:13:18 UTC (rev 171180)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2014-07-17 09:29:49 UTC (rev 171181)
@@ -1492,6 +1492,25 @@
     return WebKit::kit(gobjectResult.get());
 }
 
+WebKitDOMbool* webkit_dom_test_obj_strict_function_with_array(WebKitDOMTestObj* self, WebKitDOMTestObj* objArg, glong array, GError** error)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0);
+    g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(objArg), 0);
+    g_return_val_if_fail(WEBKIT_DOM_IS_LONG[](array), 0);
+    g_return_val_if_fail(!error || !*error, 0);
+    WebCore::TestObj* item = WebKit::core(self);
+    WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
+    WebCore::long[]* convertedArray = WebKit::core(array);
+    WebCore::ExceptionCode ec = 0;
+    RefPtr<WebCore::bool> gobjectResult = WTF::getPtr(item->strictFunctionWithArray(convertedObjArg, array, ec));
+    if (ec) {
+        WebCore::ExceptionCodeDescription ecdesc(ec);
+        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
+    }
+    return WebKit::kit(gobjectResult.get());
+}
+
 void webkit_dom_test_obj_variadic_string_method(WebKitDOMTestObj* self, const gchar* head, const gchar* tail)
 {
     WebCore::JSMainThreadNullState state;

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


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2014-07-17 08:13:18 UTC (rev 171180)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2014-07-17 09:29:49 UTC (rev 171181)
@@ -593,6 +593,20 @@
 webkit_dom_test_obj_strict_function(WebKitDOMTestObj* self, const gchar* str, gfloat a, glong b, GError** error);
 
 /**
+ * webkit_dom_test_obj_strict_function_with_array:
+ * @self: A #WebKitDOMTestObj
+ * @objArg: A #WebKitDOMTestObj
+ * @array: A #glong
+ * @error: #GError
+ *
+ * Returns: (transfer none): A #WebKitDOMbool
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API WebKitDOMbool*
+webkit_dom_test_obj_strict_function_with_array(WebKitDOMTestObj* self, WebKitDOMTestObj* objArg, glong array, GError** error);
+
+/**
  * webkit_dom_test_obj_variadic_string_method:
  * @self: A #WebKitDOMTestObj
  * @head: A #gchar

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp (171180 => 171181)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp	2014-07-17 08:13:18 UTC (rev 171180)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp	2014-07-17 09:29:49 UTC (rev 171181)
@@ -26,12 +26,10 @@
 #include "Document.h"
 #include "ExceptionCode.h"
 #include "JSMainThreadExecState.h"
-#include "WebKitDOMDOMString[]Private.h"
 #include "WebKitDOMPrivate.h"
 #include "WebKitDOMSVGPointPrivate.h"
 #include "WebKitDOMSerializedScriptValuePrivate.h"
 #include "WebKitDOMTestTypedefsPrivate.h"
-#include "WebKitDOMlong[]Private.h"
 #include "gobject/ConvertToUTF8String.h"
 #include <wtf/GetPtr.h>
 #include <wtf/RefPtr.h>
@@ -233,14 +231,14 @@
     new (priv) WebKitDOMTestTypedefsPrivate();
 }
 
-void webkit_dom_test_typedefs_func(WebKitDOMTestTypedefs* self, WebKitDOMlong[]* x)
+void webkit_dom_test_typedefs_func(WebKitDOMTestTypedefs* self, glong x)
 {
     WebCore::JSMainThreadNullState state;
     g_return_if_fail(WEBKIT_DOM_IS_TEST_TYPEDEFS(self));
     g_return_if_fail(WEBKIT_DOM_IS_LONG[](x));
     WebCore::TestTypedefs* item = WebKit::core(self);
     WebCore::long[]* convertedX = WebKit::core(x);
-    item->func(convertedX);
+    item->func(x);
 }
 
 void webkit_dom_test_typedefs_set_shadow(WebKitDOMTestTypedefs* self, gfloat width, gfloat height, gfloat blur, const gchar* color, gfloat alpha)
@@ -253,7 +251,7 @@
     item->setShadow(width, height, blur, convertedColor, alpha);
 }
 
-void webkit_dom_test_typedefs_nullable_array_arg(WebKitDOMTestTypedefs* self, WebKitDOMDOMString[]* arrayArg)
+void webkit_dom_test_typedefs_nullable_array_arg(WebKitDOMTestTypedefs* self, const gchar* arrayArg)
 {
     WebCore::JSMainThreadNullState state;
     g_return_if_fail(WEBKIT_DOM_IS_TEST_TYPEDEFS(self));

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestTypedefs.h (171180 => 171181)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestTypedefs.h	2014-07-17 08:13:18 UTC (rev 171180)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestTypedefs.h	2014-07-17 09:29:49 UTC (rev 171181)
@@ -50,12 +50,12 @@
 /**
  * webkit_dom_test_typedefs_func:
  * @self: A #WebKitDOMTestTypedefs
- * @x: A #WebKitDOMlong[]
+ * @x: A #glong
  *
  * Stability: Unstable
 **/
 WEBKIT_API void
-webkit_dom_test_typedefs_func(WebKitDOMTestTypedefs* self, WebKitDOMlong[]* x);
+webkit_dom_test_typedefs_func(WebKitDOMTestTypedefs* self, glong x);
 
 /**
  * webkit_dom_test_typedefs_set_shadow:
@@ -74,12 +74,12 @@
 /**
  * webkit_dom_test_typedefs_nullable_array_arg:
  * @self: A #WebKitDOMTestTypedefs
- * @arrayArg: A #WebKitDOMDOMString[]
+ * @arrayArg: A #gchar
  *
  * Stability: Unstable
 **/
 WEBKIT_API void
-webkit_dom_test_typedefs_nullable_array_arg(WebKitDOMTestTypedefs* self, WebKitDOMDOMString[]* arrayArg);
+webkit_dom_test_typedefs_nullable_array_arg(WebKitDOMTestTypedefs* self, const gchar* arrayArg);
 
 /**
  * webkit_dom_test_typedefs_immutable_point_function:

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


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2014-07-17 08:13:18 UTC (rev 171180)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2014-07-17 09:29:49 UTC (rev 171181)
@@ -231,10 +231,8 @@
     [StrictTypeChecking] attribute unrestricted float strictFloat;
     [StrictTypeChecking, RaisesException] bool strictFunction(DOMString str, unrestricted float a, long b);
 
-#if defined(TESTING_JS)
     [StrictTypeChecking, RaisesException] bool strictFunctionWithSequence(TestObj objArg, sequence<unsigned long> a);
     [StrictTypeChecking, RaisesException] bool strictFunctionWithArray(TestObj objArg, long[] array);
-#endif
 
     // ObjectiveC reserved words.
     readonly attribute long      description;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to