Changeset 148301 in webkit


Ignore:
Timestamp:
Apr 12, 2013 1:28:55 PM (11 years ago)
Author:
oliver@apple.com
Message:

Make CodeGeneratorJS plant comments to explain failures in the binding validation
https://bugs.webkit.org/show_bug.cgi?id=114528

Reviewed by Sam Weinig.

No change in behaviour, just make the generated bindings include comments
to aid diagnosing issues that may be non-obvious.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

  • bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestEventConstructor.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestEventTarget.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestException.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestInterface.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestNamedConstructor.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:

(WebCore::toJS):

  • bindings/scripts/test/JS/JSTestTypedefs.cpp:

(WebCore::toJS):

Location:
trunk/Source/WebCore
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148300 r148301  
     12013-04-12  Oliver Hunt  <oliver@apple.com>
     2
     3        Make CodeGeneratorJS plant comments to explain failures in the binding validation
     4        https://bugs.webkit.org/show_bug.cgi?id=114528
     5
     6        Reviewed by Sam Weinig.
     7
     8        No change in behaviour, just make the generated bindings include comments
     9        to aid diagnosing issues that may be non-obvious.
     10
     11        * bindings/scripts/CodeGeneratorJS.pm:
     12        (GenerateImplementation):
     13        * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
     14        (WebCore::toJS):
     15        * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
     16        (WebCore::toJS):
     17        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
     18        (WebCore::toJS):
     19        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
     20        (WebCore::toJS):
     21        * bindings/scripts/test/JS/JSTestException.cpp:
     22        (WebCore::toJS):
     23        * bindings/scripts/test/JS/JSTestInterface.cpp:
     24        (WebCore::toJS):
     25        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
     26        (WebCore::toJS):
     27        * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
     28        (WebCore::toJS):
     29        * bindings/scripts/test/JS/JSTestObj.cpp:
     30        (WebCore::toJS):
     31        * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
     32        (WebCore::toJS):
     33        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
     34        (WebCore::toJS):
     35        * bindings/scripts/test/JS/JSTestTypedefs.cpp:
     36        (WebCore::toJS):
     37
    1382013-04-12  Tim Horton  <timothy_horton@apple.com>
    239
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r148260 r148301  
    27362736    void* expectedVTablePointer = ${vtableRefGnu};
    27372737#if COMPILER(CLANG)
     2738    // If this fails $implType does not have a vtable, so you need to add the
     2739    // ImplementationLacksVTable attribute to the interface definition
    27382740    COMPILE_ASSERT(__is_polymorphic($implType), ${implType}_is_not_polymorphic);
    27392741#endif
    27402742#endif
     2743    // If you hit this assertion you either have a use after free bug, or
     2744    // $implType has subclasses. If $implType has subclasses that get passed
     2745    // to toJS() we currently require $interfaceName you to opt out of binding hardening
     2746    // by adding the SkipVTableValidation attribute to the interface IDL definition
    27412747    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    27422748#endif
     
    27442750        push(@implContent, <<END) if $interface->extendedAttributes->{"ImplementationLacksVTable"} && $vtableNameGnu;
    27452751#if COMPILER(CLANG)
    2746         COMPILE_ASSERT(!__is_polymorphic($implType), ${implType}_is_polymorphic_but_idl_claims_not_to_be);
     2752    // If you hit this failure the interface definition has the ImplementationLacksVTable
     2753    // attribute. You should remove that attribute. If the class has subclasses
     2754    // that may be passed through this toJS() function you should use the SkipVTableValidation
     2755    // attribute to $interfaceName.
     2756    COMPILE_ASSERT(!__is_polymorphic($implType), ${implType}_is_polymorphic_but_idl_claims_not_to_be);
    27472757#endif
    27482758END
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp

    r148260 r148301  
    257257    void* expectedVTablePointer = &_ZTVN7WebCore19TestActiveDOMObjectE[2];
    258258#if COMPILER(CLANG)
     259    // If this fails TestActiveDOMObject does not have a vtable, so you need to add the
     260    // ImplementationLacksVTable attribute to the interface definition
    259261    COMPILE_ASSERT(__is_polymorphic(TestActiveDOMObject), TestActiveDOMObject_is_not_polymorphic);
    260262#endif
    261263#endif
     264    // If you hit this assertion you either have a use after free bug, or
     265    // TestActiveDOMObject has subclasses. If TestActiveDOMObject has subclasses that get passed
     266    // to toJS() we currently require TestActiveDOMObject you to opt out of binding hardening
     267    // by adding the SkipVTableValidation attribute to the interface IDL definition
    262268    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    263269#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp

    r148260 r148301  
    241241    void* expectedVTablePointer = &_ZTVN7WebCore21TestCustomNamedGetterE[2];
    242242#if COMPILER(CLANG)
     243    // If this fails TestCustomNamedGetter does not have a vtable, so you need to add the
     244    // ImplementationLacksVTable attribute to the interface definition
    243245    COMPILE_ASSERT(__is_polymorphic(TestCustomNamedGetter), TestCustomNamedGetter_is_not_polymorphic);
    244246#endif
    245247#endif
     248    // If you hit this assertion you either have a use after free bug, or
     249    // TestCustomNamedGetter has subclasses. If TestCustomNamedGetter has subclasses that get passed
     250    // to toJS() we currently require TestCustomNamedGetter you to opt out of binding hardening
     251    // by adding the SkipVTableValidation attribute to the interface IDL definition
    246252    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    247253#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp

    r148260 r148301  
    256256    void* expectedVTablePointer = &_ZTVN7WebCore20TestEventConstructorE[2];
    257257#if COMPILER(CLANG)
     258    // If this fails TestEventConstructor does not have a vtable, so you need to add the
     259    // ImplementationLacksVTable attribute to the interface definition
    258260    COMPILE_ASSERT(__is_polymorphic(TestEventConstructor), TestEventConstructor_is_not_polymorphic);
    259261#endif
    260262#endif
     263    // If you hit this assertion you either have a use after free bug, or
     264    // TestEventConstructor has subclasses. If TestEventConstructor has subclasses that get passed
     265    // to toJS() we currently require TestEventConstructor you to opt out of binding hardening
     266    // by adding the SkipVTableValidation attribute to the interface IDL definition
    261267    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    262268#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp

    r148260 r148301  
    362362    void* expectedVTablePointer = &_ZTVN7WebCore15TestEventTargetE[2];
    363363#if COMPILER(CLANG)
     364    // If this fails TestEventTarget does not have a vtable, so you need to add the
     365    // ImplementationLacksVTable attribute to the interface definition
    364366    COMPILE_ASSERT(__is_polymorphic(TestEventTarget), TestEventTarget_is_not_polymorphic);
    365367#endif
    366368#endif
     369    // If you hit this assertion you either have a use after free bug, or
     370    // TestEventTarget has subclasses. If TestEventTarget has subclasses that get passed
     371    // to toJS() we currently require TestEventTarget you to opt out of binding hardening
     372    // by adding the SkipVTableValidation attribute to the interface IDL definition
    367373    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    368374#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp

    r148260 r148301  
    198198    void* expectedVTablePointer = &_ZTVN7WebCore13TestExceptionE[2];
    199199#if COMPILER(CLANG)
     200    // If this fails TestException does not have a vtable, so you need to add the
     201    // ImplementationLacksVTable attribute to the interface definition
    200202    COMPILE_ASSERT(__is_polymorphic(TestException), TestException_is_not_polymorphic);
    201203#endif
    202204#endif
     205    // If you hit this assertion you either have a use after free bug, or
     206    // TestException has subclasses. If TestException has subclasses that get passed
     207    // to toJS() we currently require TestException you to opt out of binding hardening
     208    // by adding the SkipVTableValidation attribute to the interface IDL definition
    203209    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    204210#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r148260 r148301  
    521521    void* expectedVTablePointer = &_ZTVN7WebCore13TestInterfaceE[2];
    522522#if COMPILER(CLANG)
     523    // If this fails TestInterface does not have a vtable, so you need to add the
     524    // ImplementationLacksVTable attribute to the interface definition
    523525    COMPILE_ASSERT(__is_polymorphic(TestInterface), TestInterface_is_not_polymorphic);
    524526#endif
    525527#endif
     528    // If you hit this assertion you either have a use after free bug, or
     529    // TestInterface has subclasses. If TestInterface has subclasses that get passed
     530    // to toJS() we currently require TestInterface you to opt out of binding hardening
     531    // by adding the SkipVTableValidation attribute to the interface IDL definition
    526532    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    527533#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp

    r148260 r148301  
    219219    void* expectedVTablePointer = &_ZTVN7WebCore26TestMediaQueryListListenerE[2];
    220220#if COMPILER(CLANG)
     221    // If this fails TestMediaQueryListListener does not have a vtable, so you need to add the
     222    // ImplementationLacksVTable attribute to the interface definition
    221223    COMPILE_ASSERT(__is_polymorphic(TestMediaQueryListListener), TestMediaQueryListListener_is_not_polymorphic);
    222224#endif
    223225#endif
     226    // If you hit this assertion you either have a use after free bug, or
     227    // TestMediaQueryListListener has subclasses. If TestMediaQueryListListener has subclasses that get passed
     228    // to toJS() we currently require TestMediaQueryListListener you to opt out of binding hardening
     229    // by adding the SkipVTableValidation attribute to the interface IDL definition
    224230    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    225231#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp

    r148260 r148301  
    233233    void* expectedVTablePointer = &_ZTVN7WebCore20TestNamedConstructorE[2];
    234234#if COMPILER(CLANG)
     235    // If this fails TestNamedConstructor does not have a vtable, so you need to add the
     236    // ImplementationLacksVTable attribute to the interface definition
    235237    COMPILE_ASSERT(__is_polymorphic(TestNamedConstructor), TestNamedConstructor_is_not_polymorphic);
    236238#endif
    237239#endif
     240    // If you hit this assertion you either have a use after free bug, or
     241    // TestNamedConstructor has subclasses. If TestNamedConstructor has subclasses that get passed
     242    // to toJS() we currently require TestNamedConstructor you to opt out of binding hardening
     243    // by adding the SkipVTableValidation attribute to the interface IDL definition
    238244    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    239245#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r148260 r148301  
    31033103    void* expectedVTablePointer = &_ZTVN7WebCore7TestObjE[2];
    31043104#if COMPILER(CLANG)
     3105    // If this fails TestObj does not have a vtable, so you need to add the
     3106    // ImplementationLacksVTable attribute to the interface definition
    31053107    COMPILE_ASSERT(__is_polymorphic(TestObj), TestObj_is_not_polymorphic);
    31063108#endif
    31073109#endif
     3110    // If you hit this assertion you either have a use after free bug, or
     3111    // TestObj has subclasses. If TestObj has subclasses that get passed
     3112    // to toJS() we currently require TestObj you to opt out of binding hardening
     3113    // by adding the SkipVTableValidation attribute to the interface IDL definition
    31083114    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    31093115#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp

    r148260 r148301  
    263263    void* expectedVTablePointer = &_ZTVN7WebCore26TestOverloadedConstructorsE[2];
    264264#if COMPILER(CLANG)
     265    // If this fails TestOverloadedConstructors does not have a vtable, so you need to add the
     266    // ImplementationLacksVTable attribute to the interface definition
    265267    COMPILE_ASSERT(__is_polymorphic(TestOverloadedConstructors), TestOverloadedConstructors_is_not_polymorphic);
    266268#endif
    267269#endif
     270    // If you hit this assertion you either have a use after free bug, or
     271    // TestOverloadedConstructors has subclasses. If TestOverloadedConstructors has subclasses that get passed
     272    // to toJS() we currently require TestOverloadedConstructors you to opt out of binding hardening
     273    // by adding the SkipVTableValidation attribute to the interface IDL definition
    268274    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    269275#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp

    r148260 r148301  
    411411    void* expectedVTablePointer = &_ZTVN7WebCore34TestSerializedScriptValueInterfaceE[2];
    412412#if COMPILER(CLANG)
     413    // If this fails TestSerializedScriptValueInterface does not have a vtable, so you need to add the
     414    // ImplementationLacksVTable attribute to the interface definition
    413415    COMPILE_ASSERT(__is_polymorphic(TestSerializedScriptValueInterface), TestSerializedScriptValueInterface_is_not_polymorphic);
    414416#endif
    415417#endif
     418    // If you hit this assertion you either have a use after free bug, or
     419    // TestSerializedScriptValueInterface has subclasses. If TestSerializedScriptValueInterface has subclasses that get passed
     420    // to toJS() we currently require TestSerializedScriptValueInterface you to opt out of binding hardening
     421    // by adding the SkipVTableValidation attribute to the interface IDL definition
    416422    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    417423#endif
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp

    r148260 r148301  
    649649    void* expectedVTablePointer = &_ZTVN7WebCore12TestTypedefsE[2];
    650650#if COMPILER(CLANG)
     651    // If this fails TestTypedefs does not have a vtable, so you need to add the
     652    // ImplementationLacksVTable attribute to the interface definition
    651653    COMPILE_ASSERT(__is_polymorphic(TestTypedefs), TestTypedefs_is_not_polymorphic);
    652654#endif
    653655#endif
     656    // If you hit this assertion you either have a use after free bug, or
     657    // TestTypedefs has subclasses. If TestTypedefs has subclasses that get passed
     658    // to toJS() we currently require TestTypedefs you to opt out of binding hardening
     659    // by adding the SkipVTableValidation attribute to the interface IDL definition
    654660    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
    655661#endif
Note: See TracChangeset for help on using the changeset viewer.