Changeset 171181 in webkit


Ignore:
Timestamp:
Jul 17, 2014 2:29:49 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Vineet Chaudhary <code.vineet@gmail.com> 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:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r171177 r171181  
     12014-07-17  Vineet Chaudhary  <code.vineet@gmail.com>
     2
     3        [GObject] StrictTypeChecking extended attribute fails for methods with sequence<T>.
     4        https://bugs.webkit.org/show_bug.cgi?id=121698
     5
     6        Reviewed by Antonio Gomes.
     7
     8        GodeGenerator was including wrong heeaders as WebKitDOMlong[] for methods with
     9        array parameters and StrictTypeChecking extended attribute.
     10        No new tests. TestObj.idl covers the tests.
     11
     12        * bindings/scripts/CodeGenerator.pm:
     13        (GetArrayOrSequenceType):
     14        * bindings/scripts/CodeGeneratorGObject.pm:
     15        (GenerateFunction):
     16        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
     17        (webkit_dom_test_obj_strict_function_with_array):
     18        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
     19        * bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp:
     20        (webkit_dom_test_typedefs_func):
     21        (webkit_dom_test_typedefs_nullable_array_arg):
     22        * bindings/scripts/test/GObject/WebKitDOMTestTypedefs.h:
     23        * bindings/scripts/test/TestObj.idl:
     24
    1252014-07-17  Yusuke Suzuki  <utatane.tea@gmail.com>
    226
  • trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm

    r168302 r171181  
    451451}
    452452
     453sub GetArrayOrSequenceType
     454{
     455    my $object = shift;
     456    my $type = shift;
     457
     458    return $object->GetArrayType($type) || $object->GetSequenceType($type);
     459}
     460
    453461sub AssertNotSequenceType
    454462{
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm

    r170708 r171181  
    969969    foreach my $param (@{$function->parameters}) {
    970970        my $paramIDLType = $param->type;
     971        my $arrayOrSequenceType = $codeGenerator->GetArrayOrSequenceType($paramIDLType);
     972        $paramIDLType = $arrayOrSequenceType if $arrayOrSequenceType ne "";
    971973        my $paramType = GetGlibTypeName($paramIDLType);
    972974        my $const = $paramType eq "gchar*" ? "const " : "";
     
    10121014
    10131015    foreach my $param (@{$function->parameters}) {
    1014         my $paramType = GetGlibTypeName($param->type);
     1016        my $paramIDLType = $param->type;
     1017        my $arrayOrSequenceType = $codeGenerator->GetArrayOrSequenceType($paramIDLType);
     1018        $paramIDLType = $arrayOrSequenceType if $arrayOrSequenceType ne "";
     1019        my $paramType = GetGlibTypeName($paramIDLType);
    10151020        # $paramType can have a trailing * in some cases
    10161021        $paramType =~ s/\*$//;
  • trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp

    r170567 r171181  
    14931493}
    14941494
     1495WebKitDOMbool* webkit_dom_test_obj_strict_function_with_array(WebKitDOMTestObj* self, WebKitDOMTestObj* objArg, glong array, GError** error)
     1496{
     1497    WebCore::JSMainThreadNullState state;
     1498    g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0);
     1499    g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(objArg), 0);
     1500    g_return_val_if_fail(WEBKIT_DOM_IS_LONG[](array), 0);
     1501    g_return_val_if_fail(!error || !*error, 0);
     1502    WebCore::TestObj* item = WebKit::core(self);
     1503    WebCore::TestObj* convertedObjArg = WebKit::core(objArg);
     1504    WebCore::long[]* convertedArray = WebKit::core(array);
     1505    WebCore::ExceptionCode ec = 0;
     1506    RefPtr<WebCore::bool> gobjectResult = WTF::getPtr(item->strictFunctionWithArray(convertedObjArg, array, ec));
     1507    if (ec) {
     1508        WebCore::ExceptionCodeDescription ecdesc(ec);
     1509        g_set_error_literal(error, g_quark_from_string("WEBKIT_DOM"), ecdesc.code, ecdesc.name);
     1510    }
     1511    return WebKit::kit(gobjectResult.get());
     1512}
     1513
    14951514void webkit_dom_test_obj_variadic_string_method(WebKitDOMTestObj* self, const gchar* head, const gchar* tail)
    14961515{
  • trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h

    r170475 r171181  
    594594
    595595/**
     596 * webkit_dom_test_obj_strict_function_with_array:
     597 * @self: A #WebKitDOMTestObj
     598 * @objArg: A #WebKitDOMTestObj
     599 * @array: A #glong
     600 * @error: #GError
     601 *
     602 * Returns: (transfer none): A #WebKitDOMbool
     603 *
     604 * Stability: Unstable
     605**/
     606WEBKIT_API WebKitDOMbool*
     607webkit_dom_test_obj_strict_function_with_array(WebKitDOMTestObj* self, WebKitDOMTestObj* objArg, glong array, GError** error);
     608
     609/**
    596610 * webkit_dom_test_obj_variadic_string_method:
    597611 * @self: A #WebKitDOMTestObj
  • trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestTypedefs.cpp

    r170567 r171181  
    2727#include "ExceptionCode.h"
    2828#include "JSMainThreadExecState.h"
    29 #include "WebKitDOMDOMString[]Private.h"
    3029#include "WebKitDOMPrivate.h"
    3130#include "WebKitDOMSVGPointPrivate.h"
    3231#include "WebKitDOMSerializedScriptValuePrivate.h"
    3332#include "WebKitDOMTestTypedefsPrivate.h"
    34 #include "WebKitDOMlong[]Private.h"
    3533#include "gobject/ConvertToUTF8String.h"
    3634#include <wtf/GetPtr.h>
     
    234232}
    235233
    236 void webkit_dom_test_typedefs_func(WebKitDOMTestTypedefs* self, WebKitDOMlong[]* x)
     234void webkit_dom_test_typedefs_func(WebKitDOMTestTypedefs* self, glong x)
    237235{
    238236    WebCore::JSMainThreadNullState state;
     
    241239    WebCore::TestTypedefs* item = WebKit::core(self);
    242240    WebCore::long[]* convertedX = WebKit::core(x);
    243     item->func(convertedX);
     241    item->func(x);
    244242}
    245243
     
    254252}
    255253
    256 void webkit_dom_test_typedefs_nullable_array_arg(WebKitDOMTestTypedefs* self, WebKitDOMDOMString[]* arrayArg)
     254void webkit_dom_test_typedefs_nullable_array_arg(WebKitDOMTestTypedefs* self, const gchar* arrayArg)
    257255{
    258256    WebCore::JSMainThreadNullState state;
  • trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestTypedefs.h

    r170422 r171181  
    5151 * webkit_dom_test_typedefs_func:
    5252 * @self: A #WebKitDOMTestTypedefs
    53  * @x: A #WebKitDOMlong[]
    54  *
    55  * Stability: Unstable
    56 **/
    57 WEBKIT_API void
    58 webkit_dom_test_typedefs_func(WebKitDOMTestTypedefs* self, WebKitDOMlong[]* x);
     53 * @x: A #glong
     54 *
     55 * Stability: Unstable
     56**/
     57WEBKIT_API void
     58webkit_dom_test_typedefs_func(WebKitDOMTestTypedefs* self, glong x);
    5959
    6060/**
     
    7575 * webkit_dom_test_typedefs_nullable_array_arg:
    7676 * @self: A #WebKitDOMTestTypedefs
    77  * @arrayArg: A #WebKitDOMDOMString[]
    78  *
    79  * Stability: Unstable
    80 **/
    81 WEBKIT_API void
    82 webkit_dom_test_typedefs_nullable_array_arg(WebKitDOMTestTypedefs* self, WebKitDOMDOMString[]* arrayArg);
     77 * @arrayArg: A #gchar
     78 *
     79 * Stability: Unstable
     80**/
     81WEBKIT_API void
     82webkit_dom_test_typedefs_nullable_array_arg(WebKitDOMTestTypedefs* self, const gchar* arrayArg);
    8383
    8484/**
  • trunk/Source/WebCore/bindings/scripts/test/TestObj.idl

    r170015 r171181  
    232232    [StrictTypeChecking, RaisesException] bool strictFunction(DOMString str, unrestricted float a, long b);
    233233
    234 #if defined(TESTING_JS)
    235234    [StrictTypeChecking, RaisesException] bool strictFunctionWithSequence(TestObj objArg, sequence<unsigned long> a);
    236235    [StrictTypeChecking, RaisesException] bool strictFunctionWithArray(TestObj objArg, long[] array);
    237 #endif
    238236
    239237    // ObjectiveC reserved words.
Note: See TracChangeset for help on using the changeset viewer.