[CodeGenerator] Only allow a single interface or standalone dictionary per WebIDL...
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2016 18:29:36 +0000 (18:29 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Oct 2016 18:29:36 +0000 (18:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163889

Reviewed by Chris Dumez.

Assert that there's only one interface or standalone dictionary
per WebIDL input file, and exit from the generator otherwise.

This avoids potential linking issues where multiple enumeration
and dictionary bindings code can be generated if the source
WebIDL for them is specified in a file that contains multiple
interfaces or standalone dictionaries.

Additionally, the generator now also exits if it fails to
generate code for any interface of standalone dictionary. This
should avoid processing WebIDL files that are empty in
substance.

TestException.idl and TestInterface.idl files have their second
interfaces removed. In place of those a new testing IDL file is
added, TestInterfaceLeadingUnderscore.idl. Like the two removed
interfaces, it tests that the leading underscode in the
identifier is removed by the generator.

* bindings/scripts/CodeGenerator.pm:
(ProcessDocument):
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: Added.
(WebCore::JSTestInterfaceLeadingUnderscorePrototype::create):
(WebCore::JSTestInterfaceLeadingUnderscorePrototype::createStructure):
(WebCore::JSTestInterfaceLeadingUnderscorePrototype::JSTestInterfaceLeadingUnderscorePrototype):
(WebCore::JSTestInterfaceLeadingUnderscoreConstructor::prototypeForStructure):
(WebCore::JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties):
(WebCore::JSTestInterfaceLeadingUnderscorePrototype::finishCreation):
(WebCore::JSTestInterfaceLeadingUnderscore::JSTestInterfaceLeadingUnderscore):
(WebCore::JSTestInterfaceLeadingUnderscore::createPrototype):
(WebCore::JSTestInterfaceLeadingUnderscore::prototype):
(WebCore::JSTestInterfaceLeadingUnderscore::destroy):
(WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute):
(WebCore::jsTestInterfaceLeadingUnderscoreReadonly):
(WebCore::jsTestInterfaceLeadingUnderscoreReadonlyGetter):
(WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
(WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
(WebCore::JSTestInterfaceLeadingUnderscore::getConstructor):
(WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestInterfaceLeadingUnderscoreOwner::finalize):
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
(WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
* bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h: Renamed from Source/WebCore/bindings/scripts/test/JS/JSreadonly.h.
(WebCore::JSTestInterfaceLeadingUnderscore::create):
(WebCore::JSTestInterfaceLeadingUnderscore::createStructure):
(WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
(WebCore::wrapperOwner):
(WebCore::wrapperKey):
(WebCore::toJS):
(WebCore::toJSNewlyCreated):
* bindings/scripts/test/JS/JSattribute.cpp: Removed.
* bindings/scripts/test/JS/JSattribute.h: Removed.
* bindings/scripts/test/JS/JSreadonly.cpp: Removed.
* bindings/scripts/test/TestException.idl:
* bindings/scripts/test/TestInterface.idl:
* bindings/scripts/test/TestInterfaceLeadingUnderscore.idl: Copied from Source/WebCore/bindings/scripts/test/TestException.idl.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207770 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h [moved from Source/WebCore/bindings/scripts/test/JS/JSattribute.h with 56% similarity]
Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp [deleted file]
Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp [deleted file]
Source/WebCore/bindings/scripts/test/JS/JSreadonly.h [deleted file]
Source/WebCore/bindings/scripts/test/TestException.idl
Source/WebCore/bindings/scripts/test/TestInterface.idl
Source/WebCore/bindings/scripts/test/TestInterfaceLeadingUnderscore.idl [new file with mode: 0644]

index 828ac92..8875ff3 100644 (file)
@@ -1,3 +1,68 @@
+2016-10-24  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CodeGenerator] Only allow a single interface or standalone dictionary per WebIDL file
+        https://bugs.webkit.org/show_bug.cgi?id=163889
+
+        Reviewed by Chris Dumez.
+
+        Assert that there's only one interface or standalone dictionary
+        per WebIDL input file, and exit from the generator otherwise.
+
+        This avoids potential linking issues where multiple enumeration
+        and dictionary bindings code can be generated if the source
+        WebIDL for them is specified in a file that contains multiple
+        interfaces or standalone dictionaries.
+
+        Additionally, the generator now also exits if it fails to
+        generate code for any interface of standalone dictionary. This
+        should avoid processing WebIDL files that are empty in
+        substance.
+
+        TestException.idl and TestInterface.idl files have their second
+        interfaces removed. In place of those a new testing IDL file is
+        added, TestInterfaceLeadingUnderscore.idl. Like the two removed
+        interfaces, it tests that the leading underscode in the
+        identifier is removed by the generator.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (ProcessDocument):
+        * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: Added.
+        (WebCore::JSTestInterfaceLeadingUnderscorePrototype::create):
+        (WebCore::JSTestInterfaceLeadingUnderscorePrototype::createStructure):
+        (WebCore::JSTestInterfaceLeadingUnderscorePrototype::JSTestInterfaceLeadingUnderscorePrototype):
+        (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::prototypeForStructure):
+        (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties):
+        (WebCore::JSTestInterfaceLeadingUnderscorePrototype::finishCreation):
+        (WebCore::JSTestInterfaceLeadingUnderscore::JSTestInterfaceLeadingUnderscore):
+        (WebCore::JSTestInterfaceLeadingUnderscore::createPrototype):
+        (WebCore::JSTestInterfaceLeadingUnderscore::prototype):
+        (WebCore::JSTestInterfaceLeadingUnderscore::destroy):
+        (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute):
+        (WebCore::jsTestInterfaceLeadingUnderscoreReadonly):
+        (WebCore::jsTestInterfaceLeadingUnderscoreReadonlyGetter):
+        (WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
+        (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
+        (WebCore::JSTestInterfaceLeadingUnderscore::getConstructor):
+        (WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots):
+        (WebCore::JSTestInterfaceLeadingUnderscoreOwner::finalize):
+        (WebCore::toJSNewlyCreated):
+        (WebCore::toJS):
+        (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
+        * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h: Renamed from Source/WebCore/bindings/scripts/test/JS/JSreadonly.h.
+        (WebCore::JSTestInterfaceLeadingUnderscore::create):
+        (WebCore::JSTestInterfaceLeadingUnderscore::createStructure):
+        (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
+        (WebCore::wrapperOwner):
+        (WebCore::wrapperKey):
+        (WebCore::toJS):
+        (WebCore::toJSNewlyCreated):
+        * bindings/scripts/test/JS/JSattribute.cpp: Removed.
+        * bindings/scripts/test/JS/JSattribute.h: Removed.
+        * bindings/scripts/test/JS/JSreadonly.cpp: Removed.
+        * bindings/scripts/test/TestException.idl:
+        * bindings/scripts/test/TestInterface.idl:
+        * bindings/scripts/test/TestInterfaceLeadingUnderscore.idl: Copied from Source/WebCore/bindings/scripts/test/TestException.idl.
+
 2016-10-21  Alex Christensen  <achristensen@webkit.org>
 
         URL::port should return Optional<uint16_t>
index 90279b9..2438205 100644 (file)
@@ -205,21 +205,28 @@ sub ProcessDocument
     }
 
     my $interfaces = $useDocument->interfaces;
-    foreach my $interface (@$interfaces) {
+    if (@$interfaces) {
+        die "Multiple interfaces per document are not supported" if @$interfaces > 1;
+
+        my $interface = @$interfaces[0];
         print "Generating $useGenerator bindings code for IDL interface \"" . $interface->name . "\"...\n" if $verbose;
-        # FIXME: Repeating each enumeration and dictionaries for every interface would not work if we actually were using
-        # multiple interfaces per file, but we aren't, so this is fine for now.
         $codeGenerator->GenerateInterface($interface, $defines, $useDocument->enumerations, $useDocument->dictionaries);
         $codeGenerator->WriteData($interface, $useOutputDir, $useOutputHeadersDir);
+        return;
     }
 
-    # It is possible to have dictionaries in an IDL file without any interface.
-    unless (@$interfaces) {
-        foreach my $dictionary (@{$useDocument->dictionaries}) {
-            $codeGenerator->GenerateDictionary($dictionary, $useDocument->enumerations);
-            $codeGenerator->WriteData($dictionary, $useOutputDir, $useOutputHeadersDir);
-        }
+    my $dictionaries = $useDocument->dictionaries;
+    if (@$dictionaries) {
+        die "Multiple standalone dictionaries per document are not supported" if @$dictionaries > 1;
+
+        my $dictionary = @$dictionaries[0];
+        print "Generating $useGenerator bindings code for IDL dictionary \"" . $dictionary->name . "\"...\n" if $verbose;
+        $codeGenerator->GenerateDictionary($dictionary, $useDocument->enumerations);
+        $codeGenerator->WriteData($dictionary, $useOutputDir, $useOutputHeadersDir);
+        return;
     }
+
+    die "Processing document " . $useDocument->fileName . " did not generate anything"
 }
 
 sub FileNamePrefix
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp
new file mode 100644 (file)
index 0000000..fd3e117
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSTestInterfaceLeadingUnderscore.h"
+
+#include "JSDOMBinding.h"
+#include "JSDOMConstructor.h"
+#include "JSDOMConvert.h"
+#include <runtime/FunctionPrototype.h>
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+// Attributes
+
+JSC::EncodedJSValue jsTestInterfaceLeadingUnderscoreReadonly(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+JSC::EncodedJSValue jsTestInterfaceLeadingUnderscoreConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestInterfaceLeadingUnderscoreConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+
+class JSTestInterfaceLeadingUnderscorePrototype : public JSC::JSNonFinalObject {
+public:
+    using Base = JSC::JSNonFinalObject;
+    static JSTestInterfaceLeadingUnderscorePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+    {
+        JSTestInterfaceLeadingUnderscorePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestInterfaceLeadingUnderscorePrototype>(vm.heap)) JSTestInterfaceLeadingUnderscorePrototype(vm, globalObject, structure);
+        ptr->finishCreation(vm);
+        return ptr;
+    }
+
+    DECLARE_INFO;
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+private:
+    JSTestInterfaceLeadingUnderscorePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+        : JSC::JSNonFinalObject(vm, structure)
+    {
+    }
+
+    void finishCreation(JSC::VM&);
+};
+
+using JSTestInterfaceLeadingUnderscoreConstructor = JSDOMConstructorNotConstructable<JSTestInterfaceLeadingUnderscore>;
+
+template<> JSValue JSTestInterfaceLeadingUnderscoreConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+    UNUSED_PARAM(vm);
+    return globalObject.functionPrototype();
+}
+
+template<> void JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    putDirect(vm, vm.propertyNames->prototype, JSTestInterfaceLeadingUnderscore::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestInterfaceLeadingUnderscore"))), ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
+}
+
+template<> const ClassInfo JSTestInterfaceLeadingUnderscoreConstructor::s_info = { "TestInterfaceLeadingUnderscore", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestInterfaceLeadingUnderscoreConstructor) };
+
+/* Hash table for prototype */
+
+static const HashTableValue JSTestInterfaceLeadingUnderscorePrototypeTableValues[] =
+{
+    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceLeadingUnderscoreConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestInterfaceLeadingUnderscoreConstructor) } },
+    { "readonly", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceLeadingUnderscoreReadonly), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
+};
+
+const ClassInfo JSTestInterfaceLeadingUnderscorePrototype::s_info = { "TestInterfaceLeadingUnderscorePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestInterfaceLeadingUnderscorePrototype) };
+
+void JSTestInterfaceLeadingUnderscorePrototype::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    reifyStaticProperties(vm, JSTestInterfaceLeadingUnderscorePrototypeTableValues, *this);
+}
+
+const ClassInfo JSTestInterfaceLeadingUnderscore::s_info = { "TestInterfaceLeadingUnderscore", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestInterfaceLeadingUnderscore) };
+
+JSTestInterfaceLeadingUnderscore::JSTestInterfaceLeadingUnderscore(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestInterfaceLeadingUnderscore>&& impl)
+    : JSDOMWrapper<TestInterfaceLeadingUnderscore>(structure, globalObject, WTFMove(impl))
+{
+}
+
+JSObject* JSTestInterfaceLeadingUnderscore::createPrototype(VM& vm, JSGlobalObject* globalObject)
+{
+    return JSTestInterfaceLeadingUnderscorePrototype::create(vm, globalObject, JSTestInterfaceLeadingUnderscorePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+}
+
+JSObject* JSTestInterfaceLeadingUnderscore::prototype(VM& vm, JSGlobalObject* globalObject)
+{
+    return getDOMPrototype<JSTestInterfaceLeadingUnderscore>(vm, globalObject);
+}
+
+void JSTestInterfaceLeadingUnderscore::destroy(JSC::JSCell* cell)
+{
+    JSTestInterfaceLeadingUnderscore* thisObject = static_cast<JSTestInterfaceLeadingUnderscore*>(cell);
+    thisObject->JSTestInterfaceLeadingUnderscore::~JSTestInterfaceLeadingUnderscore();
+}
+
+template<> inline JSTestInterfaceLeadingUnderscore* BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute(ExecState&, EncodedJSValue thisValue)
+{
+    return jsDynamicCast<JSTestInterfaceLeadingUnderscore*>(JSValue::decode(thisValue));
+}
+
+static inline JSValue jsTestInterfaceLeadingUnderscoreReadonlyGetter(ExecState&, JSTestInterfaceLeadingUnderscore&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestInterfaceLeadingUnderscoreReadonly(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    return BindingCaller<JSTestInterfaceLeadingUnderscore>::attribute<jsTestInterfaceLeadingUnderscoreReadonlyGetter>(state, thisValue, "readonly");
+}
+
+static inline JSValue jsTestInterfaceLeadingUnderscoreReadonlyGetter(ExecState& state, JSTestInterfaceLeadingUnderscore& thisObject, ThrowScope& throwScope)
+{
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(state);
+    auto& impl = thisObject.wrapped();
+    JSValue result = toJS<IDLDOMString>(state, impl.readonly());
+    return result;
+}
+
+EncodedJSValue jsTestInterfaceLeadingUnderscoreConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    VM& vm = state->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    JSTestInterfaceLeadingUnderscorePrototype* domObject = jsDynamicCast<JSTestInterfaceLeadingUnderscorePrototype*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!domObject))
+        return throwVMTypeError(state, throwScope);
+    return JSValue::encode(JSTestInterfaceLeadingUnderscore::getConstructor(state->vm(), domObject->globalObject()));
+}
+
+bool setJSTestInterfaceLeadingUnderscoreConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    VM& vm = state->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    JSValue value = JSValue::decode(encodedValue);
+    JSTestInterfaceLeadingUnderscorePrototype* domObject = jsDynamicCast<JSTestInterfaceLeadingUnderscorePrototype*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!domObject)) {
+        throwVMTypeError(state, throwScope);
+        return false;
+    }
+    // Shadowing a built-in constructor
+    return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
+}
+
+JSValue JSTestInterfaceLeadingUnderscore::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+    return getDOMConstructor<JSTestInterfaceLeadingUnderscoreConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+bool JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
+{
+    UNUSED_PARAM(handle);
+    UNUSED_PARAM(visitor);
+    return false;
+}
+
+void JSTestInterfaceLeadingUnderscoreOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+    auto* jsTestInterfaceLeadingUnderscore = jsCast<JSTestInterfaceLeadingUnderscore*>(handle.slot()->asCell());
+    auto& world = *static_cast<DOMWrapperWorld*>(context);
+    uncacheWrapper(world, &jsTestInterfaceLeadingUnderscore->wrapped(), jsTestInterfaceLeadingUnderscore);
+}
+
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestInterfaceLeadingUnderscore>&& impl)
+{
+#if COMPILER(CLANG)
+    // 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 TestInterfaceLeadingUnderscore.
+    static_assert(!__is_polymorphic(TestInterfaceLeadingUnderscore), "TestInterfaceLeadingUnderscore is polymorphic but the IDL claims it is not");
+#endif
+    return createWrapper<TestInterfaceLeadingUnderscore>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestInterfaceLeadingUnderscore& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
+TestInterfaceLeadingUnderscore* JSTestInterfaceLeadingUnderscore::toWrapped(JSC::JSValue value)
+{
+    if (auto* wrapper = jsDynamicCast<JSTestInterfaceLeadingUnderscore*>(value))
+        return &wrapper->wrapped();
+    return nullptr;
+}
+
+}
 #pragma once
 
 #include "JSDOMWrapper.h"
-#include "attribute.h"
-#include <runtime/ErrorPrototype.h>
+#include "TestInterfaceLeadingUnderscore.h"
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
-class JSattribute : public JSDOMWrapper<attribute> {
+class JSTestInterfaceLeadingUnderscore : public JSDOMWrapper<TestInterfaceLeadingUnderscore> {
 public:
-    using Base = JSDOMWrapper<attribute>;
-    static JSattribute* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<attribute>&& impl)
+    using Base = JSDOMWrapper<TestInterfaceLeadingUnderscore>;
+    static JSTestInterfaceLeadingUnderscore* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestInterfaceLeadingUnderscore>&& impl)
     {
-        JSattribute* ptr = new (NotNull, JSC::allocateCell<JSattribute>(globalObject->vm().heap)) JSattribute(structure, *globalObject, WTFMove(impl));
+        JSTestInterfaceLeadingUnderscore* ptr = new (NotNull, JSC::allocateCell<JSTestInterfaceLeadingUnderscore>(globalObject->vm().heap)) JSTestInterfaceLeadingUnderscore(structure, *globalObject, WTFMove(impl));
         ptr->finishCreation(globalObject->vm());
         return ptr;
     }
 
     static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
     static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*);
-    static attribute* toWrapped(JSC::JSValue);
+    static TestInterfaceLeadingUnderscore* toWrapped(JSC::JSValue);
     static void destroy(JSC::JSCell*);
 
     DECLARE_INFO;
@@ -50,10 +49,8 @@ public:
     }
 
     static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
-public:
-    static const unsigned StructureFlags = JSC::HasStaticPropertyTable | Base::StructureFlags;
 protected:
-    JSattribute(JSC::Structure*, JSDOMGlobalObject&, Ref<attribute>&&);
+    JSTestInterfaceLeadingUnderscore(JSC::Structure*, JSDOMGlobalObject&, Ref<TestInterfaceLeadingUnderscore>&&);
 
     void finishCreation(JSC::VM& vm)
     {
@@ -63,31 +60,31 @@ protected:
 
 };
 
-class JSattributeOwner : public JSC::WeakHandleOwner {
+class JSTestInterfaceLeadingUnderscoreOwner : public JSC::WeakHandleOwner {
 public:
     virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
     virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
 };
 
-inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, attribute*)
+inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestInterfaceLeadingUnderscore*)
 {
-    static NeverDestroyed<JSattributeOwner> owner;
+    static NeverDestroyed<JSTestInterfaceLeadingUnderscoreOwner> owner;
     return &owner.get();
 }
 
-inline void* wrapperKey(attribute* wrappableObject)
+inline void* wrapperKey(TestInterfaceLeadingUnderscore* wrappableObject)
 {
     return wrappableObject;
 }
 
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, attribute&);
-inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, attribute* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
-JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<attribute>&&);
-inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<attribute>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestInterfaceLeadingUnderscore&);
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestInterfaceLeadingUnderscore* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestInterfaceLeadingUnderscore>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestInterfaceLeadingUnderscore>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
 
-template<> struct JSDOMWrapperConverterTraits<attribute> {
-    using WrapperClass = JSattribute;
-    using ToWrappedReturnType = attribute*;
+template<> struct JSDOMWrapperConverterTraits<TestInterfaceLeadingUnderscore> {
+    using WrapperClass = JSTestInterfaceLeadingUnderscore;
+    using ToWrappedReturnType = TestInterfaceLeadingUnderscore*;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp b/Source/WebCore/bindings/scripts/test/JS/JSattribute.cpp
deleted file mode 100644 (file)
index 9c366a2..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
-    This file is part of the WebKit open source project.
-    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "JSattribute.h"
-
-#include "JSDOMBinding.h"
-#include "JSDOMConstructor.h"
-#include "JSDOMConvert.h"
-#include <runtime/FunctionPrototype.h>
-#include <wtf/GetPtr.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-// Attributes
-
-JSC::EncodedJSValue jsattributeReadonly(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-JSC::EncodedJSValue jsattributeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSattributeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
-
-class JSattributePrototype : public JSC::JSNonFinalObject {
-public:
-    using Base = JSC::JSNonFinalObject;
-    static JSattributePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
-    {
-        JSattributePrototype* ptr = new (NotNull, JSC::allocateCell<JSattributePrototype>(vm.heap)) JSattributePrototype(vm, globalObject, structure);
-        ptr->finishCreation(vm);
-        return ptr;
-    }
-
-    DECLARE_INFO;
-    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
-    {
-        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
-    }
-
-private:
-    JSattributePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
-        : JSC::JSNonFinalObject(vm, structure)
-    {
-    }
-
-    void finishCreation(JSC::VM&);
-};
-
-using JSattributeConstructor = JSDOMConstructorNotConstructable<JSattribute>;
-
-/* Hash table */
-
-static const struct CompactHashIndex JSattributeTableIndex[2] = {
-    { 0, -1 },
-    { -1, -1 },
-};
-
-
-static const HashTableValue JSattributeTableValues[] =
-{
-    { "readonly", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsattributeReadonly), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
-};
-
-static const HashTable JSattributeTable = { 1, 1, true, JSattributeTableValues, JSattributeTableIndex };
-template<> JSValue JSattributeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
-{
-    UNUSED_PARAM(vm);
-    return globalObject.functionPrototype();
-}
-
-template<> void JSattributeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
-{
-    putDirect(vm, vm.propertyNames->prototype, JSattribute::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
-    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("attribute"))), ReadOnly | DontEnum);
-    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
-}
-
-template<> const ClassInfo JSattributeConstructor::s_info = { "attribute", &Base::s_info, 0, CREATE_METHOD_TABLE(JSattributeConstructor) };
-
-/* Hash table for prototype */
-
-static const HashTableValue JSattributePrototypeTableValues[] =
-{
-    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsattributeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSattributeConstructor) } },
-};
-
-const ClassInfo JSattributePrototype::s_info = { "attributePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSattributePrototype) };
-
-void JSattributePrototype::finishCreation(VM& vm)
-{
-    Base::finishCreation(vm);
-    reifyStaticProperties(vm, JSattributePrototypeTableValues, *this);
-}
-
-const ClassInfo JSattribute::s_info = { "attribute", &Base::s_info, &JSattributeTable, CREATE_METHOD_TABLE(JSattribute) };
-
-JSattribute::JSattribute(Structure* structure, JSDOMGlobalObject& globalObject, Ref<attribute>&& impl)
-    : JSDOMWrapper<attribute>(structure, globalObject, WTFMove(impl))
-{
-}
-
-JSObject* JSattribute::createPrototype(VM& vm, JSGlobalObject* globalObject)
-{
-    return JSattributePrototype::create(vm, globalObject, JSattributePrototype::createStructure(vm, globalObject, globalObject->errorPrototype()));
-}
-
-JSObject* JSattribute::prototype(VM& vm, JSGlobalObject* globalObject)
-{
-    return getDOMPrototype<JSattribute>(vm, globalObject);
-}
-
-void JSattribute::destroy(JSC::JSCell* cell)
-{
-    JSattribute* thisObject = static_cast<JSattribute*>(cell);
-    thisObject->JSattribute::~JSattribute();
-}
-
-template<> inline JSattribute* BindingCaller<JSattribute>::castForAttribute(ExecState&, EncodedJSValue thisValue)
-{
-    return jsDynamicCast<JSattribute*>(JSValue::decode(thisValue));
-}
-
-static inline JSValue jsattributeReadonlyGetter(ExecState&, JSattribute&, ThrowScope& throwScope);
-
-EncodedJSValue jsattributeReadonly(ExecState* state, EncodedJSValue thisValue, PropertyName)
-{
-    return BindingCaller<JSattribute>::attribute<jsattributeReadonlyGetter>(state, thisValue, "readonly");
-}
-
-static inline JSValue jsattributeReadonlyGetter(ExecState& state, JSattribute& thisObject, ThrowScope& throwScope)
-{
-    UNUSED_PARAM(throwScope);
-    UNUSED_PARAM(state);
-    auto& impl = thisObject.wrapped();
-    JSValue result = toJS<IDLDOMString>(state, impl.readonly());
-    return result;
-}
-
-EncodedJSValue jsattributeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
-{
-    VM& vm = state->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    JSattributePrototype* domObject = jsDynamicCast<JSattributePrototype*>(JSValue::decode(thisValue));
-    if (UNLIKELY(!domObject))
-        return throwVMTypeError(state, throwScope);
-    return JSValue::encode(JSattribute::getConstructor(state->vm(), domObject->globalObject()));
-}
-
-bool setJSattributeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
-{
-    VM& vm = state->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    JSValue value = JSValue::decode(encodedValue);
-    JSattributePrototype* domObject = jsDynamicCast<JSattributePrototype*>(JSValue::decode(thisValue));
-    if (UNLIKELY(!domObject)) {
-        throwVMTypeError(state, throwScope);
-        return false;
-    }
-    // Shadowing a built-in constructor
-    return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
-}
-
-JSValue JSattribute::getConstructor(VM& vm, const JSGlobalObject* globalObject)
-{
-    return getDOMConstructor<JSattributeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
-}
-
-bool JSattributeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
-{
-    UNUSED_PARAM(handle);
-    UNUSED_PARAM(visitor);
-    return false;
-}
-
-void JSattributeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
-{
-    auto* jsattribute = jsCast<JSattribute*>(handle.slot()->asCell());
-    auto& world = *static_cast<DOMWrapperWorld*>(context);
-    uncacheWrapper(world, &jsattribute->wrapped(), jsattribute);
-}
-
-#if ENABLE(BINDING_INTEGRITY)
-#if PLATFORM(WIN)
-#pragma warning(disable: 4483)
-extern "C" { extern void (*const __identifier("??_7attribute@WebCore@@6B@")[])(); }
-#else
-extern "C" { extern void* _ZTVN7WebCore9attributeE[]; }
-#endif
-#endif
-
-JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<attribute>&& impl)
-{
-
-#if ENABLE(BINDING_INTEGRITY)
-    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
-#if PLATFORM(WIN)
-    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7attribute@WebCore@@6B@"));
-#else
-    void* expectedVTablePointer = &_ZTVN7WebCore9attributeE[2];
-#if COMPILER(CLANG)
-    // If this fails attribute does not have a vtable, so you need to add the
-    // ImplementationLacksVTable attribute to the interface definition
-    static_assert(__is_polymorphic(attribute), "attribute is not polymorphic");
-#endif
-#endif
-    // If you hit this assertion you either have a use after free bug, or
-    // attribute has subclasses. If attribute has subclasses that get passed
-    // to toJS() we currently require attribute you to opt out of binding hardening
-    // by adding the SkipVTableValidation attribute to the interface IDL definition
-    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
-#endif
-    return createWrapper<attribute>(globalObject, WTFMove(impl));
-}
-
-JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, attribute& impl)
-{
-    return wrap(state, globalObject, impl);
-}
-
-attribute* JSattribute::toWrapped(JSC::JSValue value)
-{
-    if (auto* wrapper = jsDynamicCast<JSattribute*>(value))
-        return &wrapper->wrapped();
-    return nullptr;
-}
-
-}
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp b/Source/WebCore/bindings/scripts/test/JS/JSreadonly.cpp
deleted file mode 100644 (file)
index 7b0f726..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
-    This file is part of the WebKit open source project.
-    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "JSreadonly.h"
-
-#include "JSDOMBinding.h"
-#include "JSDOMConstructor.h"
-#include <runtime/FunctionPrototype.h>
-#include <wtf/GetPtr.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-// Attributes
-
-JSC::EncodedJSValue jsreadonlyConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSreadonlyConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
-
-class JSreadonlyPrototype : public JSC::JSNonFinalObject {
-public:
-    using Base = JSC::JSNonFinalObject;
-    static JSreadonlyPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
-    {
-        JSreadonlyPrototype* ptr = new (NotNull, JSC::allocateCell<JSreadonlyPrototype>(vm.heap)) JSreadonlyPrototype(vm, globalObject, structure);
-        ptr->finishCreation(vm);
-        return ptr;
-    }
-
-    DECLARE_INFO;
-    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
-    {
-        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
-    }
-
-private:
-    JSreadonlyPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
-        : JSC::JSNonFinalObject(vm, structure)
-    {
-    }
-
-    void finishCreation(JSC::VM&);
-};
-
-using JSreadonlyConstructor = JSDOMConstructorNotConstructable<JSreadonly>;
-
-template<> JSValue JSreadonlyConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
-{
-    UNUSED_PARAM(vm);
-    return globalObject.functionPrototype();
-}
-
-template<> void JSreadonlyConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
-{
-    putDirect(vm, vm.propertyNames->prototype, JSreadonly::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
-    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("readonly"))), ReadOnly | DontEnum);
-    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
-}
-
-template<> const ClassInfo JSreadonlyConstructor::s_info = { "readonly", &Base::s_info, 0, CREATE_METHOD_TABLE(JSreadonlyConstructor) };
-
-/* Hash table for prototype */
-
-static const HashTableValue JSreadonlyPrototypeTableValues[] =
-{
-    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsreadonlyConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSreadonlyConstructor) } },
-};
-
-const ClassInfo JSreadonlyPrototype::s_info = { "readonlyPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSreadonlyPrototype) };
-
-void JSreadonlyPrototype::finishCreation(VM& vm)
-{
-    Base::finishCreation(vm);
-    reifyStaticProperties(vm, JSreadonlyPrototypeTableValues, *this);
-}
-
-const ClassInfo JSreadonly::s_info = { "readonly", &Base::s_info, 0, CREATE_METHOD_TABLE(JSreadonly) };
-
-JSreadonly::JSreadonly(Structure* structure, JSDOMGlobalObject& globalObject, Ref<readonly>&& impl)
-    : JSDOMWrapper<readonly>(structure, globalObject, WTFMove(impl))
-{
-}
-
-JSObject* JSreadonly::createPrototype(VM& vm, JSGlobalObject* globalObject)
-{
-    return JSreadonlyPrototype::create(vm, globalObject, JSreadonlyPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
-}
-
-JSObject* JSreadonly::prototype(VM& vm, JSGlobalObject* globalObject)
-{
-    return getDOMPrototype<JSreadonly>(vm, globalObject);
-}
-
-void JSreadonly::destroy(JSC::JSCell* cell)
-{
-    JSreadonly* thisObject = static_cast<JSreadonly*>(cell);
-    thisObject->JSreadonly::~JSreadonly();
-}
-
-EncodedJSValue jsreadonlyConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
-{
-    VM& vm = state->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    JSreadonlyPrototype* domObject = jsDynamicCast<JSreadonlyPrototype*>(JSValue::decode(thisValue));
-    if (UNLIKELY(!domObject))
-        return throwVMTypeError(state, throwScope);
-    return JSValue::encode(JSreadonly::getConstructor(state->vm(), domObject->globalObject()));
-}
-
-bool setJSreadonlyConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
-{
-    VM& vm = state->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    JSValue value = JSValue::decode(encodedValue);
-    JSreadonlyPrototype* domObject = jsDynamicCast<JSreadonlyPrototype*>(JSValue::decode(thisValue));
-    if (UNLIKELY(!domObject)) {
-        throwVMTypeError(state, throwScope);
-        return false;
-    }
-    // Shadowing a built-in constructor
-    return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
-}
-
-JSValue JSreadonly::getConstructor(VM& vm, const JSGlobalObject* globalObject)
-{
-    return getDOMConstructor<JSreadonlyConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
-}
-
-bool JSreadonlyOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
-{
-    UNUSED_PARAM(handle);
-    UNUSED_PARAM(visitor);
-    return false;
-}
-
-void JSreadonlyOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
-{
-    auto* jsreadonly = jsCast<JSreadonly*>(handle.slot()->asCell());
-    auto& world = *static_cast<DOMWrapperWorld*>(context);
-    uncacheWrapper(world, &jsreadonly->wrapped(), jsreadonly);
-}
-
-JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<readonly>&& impl)
-{
-#if COMPILER(CLANG)
-    // 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 readonly.
-    static_assert(!__is_polymorphic(readonly), "readonly is polymorphic but the IDL claims it is not");
-#endif
-    return createWrapper<readonly>(globalObject, WTFMove(impl));
-}
-
-JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, readonly& impl)
-{
-    return wrap(state, globalObject, impl);
-}
-
-readonly* JSreadonly::toWrapped(JSC::JSValue value)
-{
-    if (auto* wrapper = jsDynamicCast<JSreadonly*>(value))
-        return &wrapper->wrapped();
-    return nullptr;
-}
-
-}
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSreadonly.h b/Source/WebCore/bindings/scripts/test/JS/JSreadonly.h
deleted file mode 100644 (file)
index c242d2f..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-    This file is part of the WebKit open source project.
-    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#pragma once
-
-#include "JSDOMWrapper.h"
-#include "readonly.h"
-#include <wtf/NeverDestroyed.h>
-
-namespace WebCore {
-
-class JSreadonly : public JSDOMWrapper<readonly> {
-public:
-    using Base = JSDOMWrapper<readonly>;
-    static JSreadonly* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<readonly>&& impl)
-    {
-        JSreadonly* ptr = new (NotNull, JSC::allocateCell<JSreadonly>(globalObject->vm().heap)) JSreadonly(structure, *globalObject, WTFMove(impl));
-        ptr->finishCreation(globalObject->vm());
-        return ptr;
-    }
-
-    static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
-    static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*);
-    static readonly* toWrapped(JSC::JSValue);
-    static void destroy(JSC::JSCell*);
-
-    DECLARE_INFO;
-
-    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
-    {
-        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
-    }
-
-    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
-protected:
-    JSreadonly(JSC::Structure*, JSDOMGlobalObject&, Ref<readonly>&&);
-
-    void finishCreation(JSC::VM& vm)
-    {
-        Base::finishCreation(vm);
-        ASSERT(inherits(info()));
-    }
-
-};
-
-class JSreadonlyOwner : public JSC::WeakHandleOwner {
-public:
-    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
-    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
-};
-
-inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, readonly*)
-{
-    static NeverDestroyed<JSreadonlyOwner> owner;
-    return &owner.get();
-}
-
-inline void* wrapperKey(readonly* wrappableObject)
-{
-    return wrappableObject;
-}
-
-JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, readonly&);
-inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, readonly* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
-JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<readonly>&&);
-inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<readonly>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
-
-template<> struct JSDOMWrapperConverterTraits<readonly> {
-    using WrapperClass = JSreadonly;
-    using ToWrappedReturnType = readonly*;
-};
-
-} // namespace WebCore
index 27dd286..4633be3 100644 (file)
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 exception TestException {
    readonly attribute DOMString name;
 };
-
-// Identifiers with a leading underscore, which should be removed.
-exception _attribute {
-   readonly attribute DOMString _readonly;
-};
index d596492..1c38bd0 100644 (file)
@@ -41,8 +41,3 @@
 };
 
 TestInterface implements TestImplements;
-
-[
-    ImplementationLacksVTable
-] interface _readonly {
-};
diff --git a/Source/WebCore/bindings/scripts/test/TestInterfaceLeadingUnderscore.idl b/Source/WebCore/bindings/scripts/test/TestInterfaceLeadingUnderscore.idl
new file mode 100644 (file)
index 0000000..47e4271
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010, 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary formstrArg, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIEstrArg, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Identifiers with a leading underscore, which should be removed.
+[
+    ImplementationLacksVTable
+] interface _TestInterfaceLeadingUnderscore {
+   readonly attribute DOMString _readonly;
+};