Title: [148301] trunk/Source/WebCore
Revision
148301
Author
[email protected]
Date
2013-04-12 13:28:55 -0700 (Fri, 12 Apr 2013)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148300 => 148301)


--- trunk/Source/WebCore/ChangeLog	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/ChangeLog	2013-04-12 20:28:55 UTC (rev 148301)
@@ -1,3 +1,40 @@
+2013-04-12  Oliver Hunt  <[email protected]>
+
+        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):
+
 2013-04-12  Tim Horton  <[email protected]>
 
         REGRESSION (r138858): GIFs don't start playing when they come out of background tabs

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-04-12 20:28:55 UTC (rev 148301)
@@ -2735,15 +2735,25 @@
 #else
     void* expectedVTablePointer = ${vtableRefGnu};
 #if COMPILER(CLANG)
+    // If this fails $implType does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic($implType), ${implType}_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // $implType has subclasses. If $implType has subclasses that get passed
+    // to toJS() we currently require $interfaceName you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
 END
         push(@implContent, <<END) if $interface->extendedAttributes->{"ImplementationLacksVTable"} && $vtableNameGnu;
 #if COMPILER(CLANG)
-        COMPILE_ASSERT(!__is_polymorphic($implType), ${implType}_is_polymorphic_but_idl_claims_not_to_be);
+    // If you hit this failure the interface definition has the ImplementationLacksVTable
+    // attribute. You should remove that attribute. If the class has subclasses
+    // that may be passed through this toJS() function you should use the SkipVTableValidation
+    // attribute to $interfaceName.
+    COMPILE_ASSERT(!__is_polymorphic($implType), ${implType}_is_polymorphic_but_idl_claims_not_to_be);
 #endif
 END
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -256,9 +256,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore19TestActiveDOMObjectE[2];
 #if COMPILER(CLANG)
+    // If this fails TestActiveDOMObject does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestActiveDOMObject), TestActiveDOMObject_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestActiveDOMObject has subclasses. If TestActiveDOMObject has subclasses that get passed
+    // to toJS() we currently require TestActiveDOMObject you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestActiveDOMObject>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -240,9 +240,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore21TestCustomNamedGetterE[2];
 #if COMPILER(CLANG)
+    // If this fails TestCustomNamedGetter does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestCustomNamedGetter), TestCustomNamedGetter_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestCustomNamedGetter has subclasses. If TestCustomNamedGetter has subclasses that get passed
+    // to toJS() we currently require TestCustomNamedGetter you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestCustomNamedGetter>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -255,9 +255,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore20TestEventConstructorE[2];
 #if COMPILER(CLANG)
+    // If this fails TestEventConstructor does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestEventConstructor), TestEventConstructor_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestEventConstructor has subclasses. If TestEventConstructor has subclasses that get passed
+    // to toJS() we currently require TestEventConstructor you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestEventConstructor>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -361,9 +361,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore15TestEventTargetE[2];
 #if COMPILER(CLANG)
+    // If this fails TestEventTarget does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestEventTarget), TestEventTarget_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestEventTarget has subclasses. If TestEventTarget has subclasses that get passed
+    // to toJS() we currently require TestEventTarget you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestEventTarget>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -197,9 +197,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore13TestExceptionE[2];
 #if COMPILER(CLANG)
+    // If this fails TestException does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestException), TestException_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestException has subclasses. If TestException has subclasses that get passed
+    // to toJS() we currently require TestException you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestException>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -520,9 +520,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore13TestInterfaceE[2];
 #if COMPILER(CLANG)
+    // If this fails TestInterface does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestInterface), TestInterface_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestInterface has subclasses. If TestInterface has subclasses that get passed
+    // to toJS() we currently require TestInterface you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestInterface>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -218,9 +218,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore26TestMediaQueryListListenerE[2];
 #if COMPILER(CLANG)
+    // If this fails TestMediaQueryListListener does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestMediaQueryListListener), TestMediaQueryListListener_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestMediaQueryListListener has subclasses. If TestMediaQueryListListener has subclasses that get passed
+    // to toJS() we currently require TestMediaQueryListListener you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestMediaQueryListListener>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -232,9 +232,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore20TestNamedConstructorE[2];
 #if COMPILER(CLANG)
+    // If this fails TestNamedConstructor does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestNamedConstructor), TestNamedConstructor_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestNamedConstructor has subclasses. If TestNamedConstructor has subclasses that get passed
+    // to toJS() we currently require TestNamedConstructor you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestNamedConstructor>(exec, globalObject, impl);

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -3102,9 +3102,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore7TestObjE[2];
 #if COMPILER(CLANG)
+    // If this fails TestObj does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestObj), TestObj_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestObj has subclasses. If TestObj has subclasses that get passed
+    // to toJS() we currently require TestObj you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestObj>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -262,9 +262,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore26TestOverloadedConstructorsE[2];
 #if COMPILER(CLANG)
+    // If this fails TestOverloadedConstructors does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestOverloadedConstructors), TestOverloadedConstructors_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestOverloadedConstructors has subclasses. If TestOverloadedConstructors has subclasses that get passed
+    // to toJS() we currently require TestOverloadedConstructors you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestOverloadedConstructors>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -410,9 +410,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore34TestSerializedScriptValueInterfaceE[2];
 #if COMPILER(CLANG)
+    // If this fails TestSerializedScriptValueInterface does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestSerializedScriptValueInterface), TestSerializedScriptValueInterface_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestSerializedScriptValueInterface has subclasses. If TestSerializedScriptValueInterface has subclasses that get passed
+    // to toJS() we currently require TestSerializedScriptValueInterface you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestSerializedScriptValueInterface>(exec, globalObject, impl);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (148300 => 148301)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp	2013-04-12 20:17:00 UTC (rev 148300)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp	2013-04-12 20:28:55 UTC (rev 148301)
@@ -648,9 +648,15 @@
 #else
     void* expectedVTablePointer = &_ZTVN7WebCore12TestTypedefsE[2];
 #if COMPILER(CLANG)
+    // If this fails TestTypedefs does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
     COMPILE_ASSERT(__is_polymorphic(TestTypedefs), TestTypedefs_is_not_polymorphic);
 #endif
 #endif
+    // If you hit this assertion you either have a use after free bug, or
+    // TestTypedefs has subclasses. If TestTypedefs has subclasses that get passed
+    // to toJS() we currently require TestTypedefs you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 #endif
     return createNewWrapper<JSTestTypedefs>(exec, globalObject, impl);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to