Title: [290845] trunk/Source/WebCore
Revision
290845
Author
[email protected]
Date
2022-03-04 14:08:20 -0800 (Fri, 04 Mar 2022)

Log Message

Support constants in IDL namespaces.
https://bugs.webkit.org/show_bug.cgi?id=232557
<radr://problem/85142162>

Patch by Dan Glastonbury <[email protected]> on 2022-03-04
Reviewed by Sam Weinig.

Test: bindings/script/test/TestNamespaceConst.idl

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateConstructorHelperMethods):
If namespace contains only constants, globalObject is unused
produces a compile error. Add UNUSED_PARAM to quiet error.
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/IDLParser.pm:
(convertNamespaceToInterface): Copy namespace constants to new interface.
(applyTypedefs): Apply typedefs to namespace constants.
(parseNamespace): Added parsed constants to namespace's list of constants.
(parseNamespaceMember): Accept constants as namespace members.
* bindings/scripts/test/BindingTestGlobalConstructors.idl:
* bindings/scripts/test/JS/*: Updated.
* bindings/scripts/test/SupplementalDependencies.dep:
* bindings/scripts/test/TestNamespaceConst.idl: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (290844 => 290845)


--- trunk/Source/WebCore/ChangeLog	2022-03-04 21:58:40 UTC (rev 290844)
+++ trunk/Source/WebCore/ChangeLog	2022-03-04 22:08:20 UTC (rev 290845)
@@ -1,3 +1,28 @@
+2022-03-04  Dan Glastonbury  <[email protected]>
+
+        Support constants in IDL namespaces.
+        https://bugs.webkit.org/show_bug.cgi?id=232557
+        <radr://problem/85142162>
+
+        Reviewed by Sam Weinig.
+
+        Test: bindings/script/test/TestNamespaceConst.idl
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateConstructorHelperMethods):
+        If namespace contains only constants, globalObject is unused
+        produces a compile error. Add UNUSED_PARAM to quiet error.
+        * bindings/scripts/IDLAttributes.json:
+        * bindings/scripts/IDLParser.pm:
+        (convertNamespaceToInterface): Copy namespace constants to new interface.
+        (applyTypedefs): Apply typedefs to namespace constants.
+        (parseNamespace): Added parsed constants to namespace's list of constants.
+        (parseNamespaceMember): Accept constants as namespace members.
+        * bindings/scripts/test/BindingTestGlobalConstructors.idl:
+        * bindings/scripts/test/JS/*: Updated.
+        * bindings/scripts/test/SupplementalDependencies.dep:
+        * bindings/scripts/test/TestNamespaceConst.idl: Added.
+
 2022-03-04  Chris Dumez  <[email protected]>
 
         Load event never firing after form is submitted

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (290844 => 290845)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2022-03-04 21:58:40 UTC (rev 290844)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2022-03-04 22:08:20 UTC (rev 290845)
@@ -7878,6 +7878,10 @@
 
     my @runtimeEnabledProperties = GetRuntimeEnabledStaticProperties($interface);
 
+    if ($interface->isNamespaceObject && scalar(@runtimeEnabledProperties) == 0) {
+        push(@$outputArray, "    UNUSED_PARAM(globalObject);\n");
+    }
+
     foreach my $operationOrAttribute (@runtimeEnabledProperties) {
         my $conditionalString = $codeGenerator->GenerateConditionalString($operationOrAttribute);
         push(@$outputArray, "#if ${conditionalString}\n") if $conditionalString;

Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (290844 => 290845)


--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2022-03-04 21:58:40 UTC (rev 290844)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2022-03-04 22:08:20 UTC (rev 290845)
@@ -187,6 +187,7 @@
 # https://webidl.spec.whatwg.org/#idl-namespaces
 struct( IDLNamespace => {
     name => '$',
+    constants => '@', # List of 'IDLConstant'
     operations => '@', # List of 'IDLOperation'
     attributes => '@', # List of 'IDLAttribute'
     isPartial => '$', # Used for partial namespaces
@@ -334,6 +335,8 @@
         push(@{$interface->attributes}, $attribute);
     }
 
+    push(@{$interface->constants}, @{$namespace->constants});
+
     $interface->isNamespaceObject(1);
     $interface->isPartial($namespace->isPartial);
     $interface->extendedAttributes($namespace->extendedAttributes);
@@ -620,7 +623,7 @@
 my $nextCallbackInterfaceMembers_1 = '^(\(|const|ByteString|DOMString|USVString|any|boolean|byte|double|float|long|object|octet|sequence|short|symbol|undefined|unrestricted|unsigned)$';
 my $nextInterfaceMembers_1 = '^(\(|ByteString|DOMString|USVString|any|attribute|boolean|byte|const|constructor|deleter|double|float|getter|inherit|long|object|octet|readonly|sequence|setter|short|static|stringifier|symbol|undefined|unrestricted|unsigned)$';
 my $nextMixinMembers_1 = '^(\(|attribute|ByteString|DOMString|USVString|any|boolean|byte|const|double|float|long|object|octet|readonly|sequence|short|stringifier|symbol|undefined|unrestricted|unsigned)$';
-my $nextNamespaceMembers_1 = '^(\(|ByteString|DOMString|USVString|any|boolean|byte|double|float|long|object|octet|readonly|sequence|short|symbol|undefined|unrestricted|unsigned)$';
+my $nextNamespaceMembers_1 = '^(\(|ByteString|DOMString|USVString|any|boolean|byte|const|double|float|long|object|octet|readonly|sequence|short|symbol|undefined|unrestricted|unsigned)$';
 my $nextPartialInterfaceMember_1 = '^(\(|ByteString|DOMString|USVString|any|attribute|boolean|byte|const|deleter|double|float|getter|inherit|long|object|octet|readonly|sequence|setter|short|static|stringifier|symbol|undefined|unrestricted|unsigned)$';
 my $nextSingleType_1 = '^(ByteString|DOMString|USVString|boolean|byte|double|float|long|object|octet|sequence|short|symbol|undefined|unrestricted|unsigned)$';
 my $nextArgumentName_1 = '^(async|attribute|callback|const|constructor|deleter|dictionary|enum|getter|includes|inherit|interface|iterable|maplike|mixin|namespace|partial|readonly|required|setlike|setter|static|stringifier|typedef|unrestricted)$';
@@ -713,6 +716,9 @@
         } elsif (ref($definition) eq "IDLCallbackFunction") {
             $self->applyTypedefsToOperation($definition->operation);
         } elsif (ref($definition) eq "IDLNamespace") {
+            foreach my $constant (@{$definition->constants}) {
+                $constant->type($self->typeByApplyingTypedefs($constant->type));
+            }
             foreach my $operation (@{$definition->operations}) {
                 $self->applyTypedefsToOperation($operation);
             }
@@ -1056,6 +1062,10 @@
                 push(@{$namespace->attributes}, $namespaceMember);
                 next;
             }
+            if (ref($namespaceMember) eq "IDLConstant") {
+                push(@{$namespace->constants}, $namespaceMember);
+                next;
+            }
             if (ref($namespaceMember) eq "IDLOperation") {
                 push(@{$namespace->operations}, $namespaceMember);
                 next;
@@ -1098,6 +1108,9 @@
     my $extendedAttributeList = shift;
 
     my $next = $self->nextToken();
+    if ($next->value() eq "const") {
+        return $self->parseConst($extendedAttributeList);
+    }
     if ($next->value() eq "readonly") {
         $self->assertTokenValue($self->getToken(), "readonly", __LINE__);
         my $attribute = $self->parseAttributeRest($extendedAttributeList);

Modified: trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl (290844 => 290845)


--- trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl	2022-03-04 21:58:40 UTC (rev 290844)
+++ trunk/Source/WebCore/bindings/scripts/test/BindingTestGlobalConstructors.idl	2022-03-04 22:08:20 UTC (rev 290845)
@@ -45,6 +45,7 @@
     attribute TestNamedSetterWithLegacyOverrideBuiltInsConstructor TestNamedSetterWithLegacyOverrideBuiltIns;
     attribute TestNamedSetterWithLegacyUnforgeablePropertiesConstructor TestNamedSetterWithLegacyUnforgeableProperties;
     attribute TestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltInsConstructor TestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns;
+    attribute TestNamespaceConstConstructor TestNamespaceConst;
     [SecureContext] attribute TestNamespaceObjectConstructor TestInterfaceName;
     [Conditional=ConditionDerived] attribute TestOperationConditionalConstructor TestOperationConditional;
     attribute TestOverloadedConstructorsWithSequenceConstructor TestOverloadedConstructorsWithSequence;

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (290844 => 290845)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2022-03-04 21:58:40 UTC (rev 290844)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp	2022-03-04 22:08:20 UTC (rev 290845)
@@ -84,6 +84,7 @@
 #include "JSTestNamedSetterWithLegacyOverrideBuiltIns.h"
 #include "JSTestNamedSetterWithLegacyUnforgeableProperties.h"
 #include "JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.h"
+#include "JSTestNamespaceConst.h"
 #include "JSTestNamespaceObject.h"
 #include "JSTestOverloadedConstructorsWithSequence.h"
 #include "JSTestPluginInterface.h"
@@ -218,6 +219,7 @@
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestNamedSetterWithLegacyOverrideBuiltInsConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestNamedSetterWithLegacyUnforgeablePropertiesConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltInsConstructor);
+static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestNamespaceConstConstructor);
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestInterfaceNameConstructor);
 #if ENABLE(ConditionDerived)
 static JSC_DECLARE_CUSTOM_GETTER(jsTestGlobalObject_TestOperationConditionalConstructor);
@@ -260,7 +262,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 54, -1 },
+    { 55, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -268,7 +270,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 63, -1 },
+    { 64, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -288,15 +290,15 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 67, -1 },
+    { 68, -1 },
     { 13, 261 },
     { -1, -1 },
     { -1, -1 },
+    { 49, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { -1, -1 },
     { 39, -1 },
     { 20, 258 },
     { 6, -1 },
@@ -332,7 +334,7 @@
     { -1, -1 },
     { -1, -1 },
     { 30, -1 },
-    { 56, -1 },
+    { 57, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -341,7 +343,7 @@
     { -1, -1 },
     { 9, 257 },
     { -1, -1 },
-    { 58, -1 },
+    { 59, -1 },
     { 19, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -387,7 +389,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 53, -1 },
+    { 54, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -405,10 +407,10 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 64, -1 },
-    { -1, -1 },
     { 65, -1 },
     { -1, -1 },
+    { 66, -1 },
+    { -1, -1 },
     { 27, -1 },
     { 32, -1 },
     { -1, -1 },
@@ -422,7 +424,7 @@
     { -1, -1 },
     { 15, 260 },
     { -1, -1 },
-    { 59, -1 },
+    { 60, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -435,7 +437,7 @@
     { -1, -1 },
     { 16, 256 },
     { -1, -1 },
-    { 62, -1 },
+    { 63, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -467,7 +469,7 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 57, -1 },
+    { 58, -1 },
     { -1, -1 },
     { 1, -1 },
     { -1, -1 },
@@ -476,10 +478,10 @@
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
-    { 49, 264 },
+    { 50, 264 },
     { 7, 263 },
     { -1, -1 },
-    { 60, -1 },
+    { 61, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
@@ -496,13 +498,13 @@
     { -1, -1 },
     { -1, -1 },
     { 3, -1 },
-    { 51, -1 },
-    { -1, -1 },
     { 52, -1 },
     { -1, -1 },
+    { 53, -1 },
     { -1, -1 },
     { -1, -1 },
     { -1, -1 },
+    { -1, -1 },
     { 17, -1 },
     { 23, 259 },
     { 26, 265 },
@@ -511,10 +513,10 @@
     { 40, -1 },
     { 42, -1 },
     { 44, -1 },
-    { 50, -1 },
-    { 55, -1 },
-    { 61, -1 },
-    { 66, -1 },
+    { 51, -1 },
+    { 56, -1 },
+    { 62, -1 },
+    { 67, -1 },
 };
 
 
@@ -577,6 +579,7 @@
     { "TestNamedSetterWithLegacyOverrideBuiltIns", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestNamedSetterWithLegacyOverrideBuiltInsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
     { "TestNamedSetterWithLegacyUnforgeableProperties", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestNamedSetterWithLegacyUnforgeablePropertiesConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
     { "TestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltInsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
+    { "TestNamespaceConst", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestNamespaceConstConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
 #if ENABLE(ConditionDerived)
     { "TestOperationConditional", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObject_TestOperationConditionalConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
 #else
@@ -606,7 +609,7 @@
     { "regularOperation", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestGlobalObjectInstanceFunction_regularOperation), (intptr_t) (1) } },
 };
 
-static const HashTable JSTestGlobalObjectTable = { 68, 255, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex };
+static const HashTable JSTestGlobalObjectTable = { 69, 255, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex };
 /* Hash table for constructor */
 
 static const HashTableValue JSTestGlobalObjectConstructorTableValues[] =
@@ -1380,6 +1383,17 @@
     return IDLAttribute<JSTestGlobalObject>::get<jsTestGlobalObject_TestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltInsConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
 }
 
+static inline JSValue jsTestGlobalObject_TestNamespaceConstConstructorGetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject)
+{
+    UNUSED_PARAM(lexicalGlobalObject);
+    return JSTestNamespaceConst::getConstructor(JSC::getVM(&lexicalGlobalObject), &thisObject);
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestGlobalObject_TestNamespaceConstConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName))
+{
+    return IDLAttribute<JSTestGlobalObject>::get<jsTestGlobalObject_TestNamespaceConstConstructorGetter>(*lexicalGlobalObject, thisValue, attributeName);
+}
+
 static inline JSValue jsTestGlobalObject_TestInterfaceNameConstructorGetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject)
 {
     UNUSED_PARAM(lexicalGlobalObject);

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamespaceConst.cpp (0 => 290845)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamespaceConst.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamespaceConst.cpp	2022-03-04 22:08:20 UTC (rev 290845)
@@ -0,0 +1,110 @@
+/*
+    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 "JSTestNamespaceConst.h"
+
+#include "ActiveDOMObject.h"
+#include "ExtendedDOMClientIsoSubspaces.h"
+#include "ExtendedDOMIsoSubspaces.h"
+#include "JSDOMBinding.h"
+#include "JSDOMConstructorNotCallable.h"
+#include "JSDOMExceptionHandling.h"
+#include "JSDOMGlobalObjectInlines.h"
+#include "JSDOMWrapperCache.h"
+#include "TestNamespaceConst.h"
+#include "WebCoreJSClientData.h"
+#include <_javascript_Core/JSCInlines.h>
+#include <_javascript_Core/JSDestructibleObjectHeapCellType.h>
+#include <_javascript_Core/ObjectPrototype.h>
+#include <_javascript_Core/SlotVisitorMacros.h>
+#include <_javascript_Core/SubspaceInlines.h>
+#include <wtf/GetPtr.h>
+#include <wtf/PointerPreparations.h>
+
+
+namespace WebCore {
+using namespace JSC;
+
+using JSTestNamespaceConstDOMConstructor = JSDOMConstructorNotCallable<JSTestNamespaceConst>;
+
+/* Hash table for constructor */
+
+static const HashTableValue JSTestNamespaceConstConstructorTableValues[] =
+{
+    { "TEST_FLAG", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(false) } },
+    { "TEST_BIT_MASK", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0x0000fc00) } },
+};
+
+static_assert(TestNamespaceConst::TEST_FLAG == false, "TEST_FLAG in TestNamespaceConst does not match value from IDL");
+static_assert(TestNamespaceConst::TEST_BIT_MASK == 0x0000fc00, "TEST_BIT_MASK in TestNamespaceConst does not match value from IDL");
+
+template<> const ClassInfo JSTestNamespaceConstDOMConstructor::s_info = { "TestNamespaceConst", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamespaceConstDOMConstructor) };
+
+template<> JSValue JSTestNamespaceConstDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+    UNUSED_PARAM(vm);
+    return globalObject.objectPrototype();
+}
+
+template<> void JSTestNamespaceConstDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
+    reifyStaticProperties(vm, JSTestNamespaceConst::info(), JSTestNamespaceConstConstructorTableValues, *this);
+    UNUSED_PARAM(globalObject);
+}
+
+const ClassInfo JSTestNamespaceConst::s_info = { "TestNamespaceConst", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamespaceConst) };
+
+JSTestNamespaceConst::JSTestNamespaceConst(Structure* structure, JSDOMGlobalObject& globalObject)
+    : JSDOMObject(structure, globalObject) { }
+
+void JSTestNamespaceConst::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    ASSERT(inherits(vm, info()));
+
+    static_assert(!std::is_base_of<ActiveDOMObject, TestNamespaceConst>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject.");
+
+}
+
+JSValue JSTestNamespaceConst::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+    return getDOMConstructor<JSTestNamespaceConstDOMConstructor, DOMConstructorID::TestNamespaceConst>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+void JSTestNamespaceConst::destroy(JSC::JSCell* cell)
+{
+    JSTestNamespaceConst* thisObject = static_cast<JSTestNamespaceConst*>(cell);
+    thisObject->JSTestNamespaceConst::~JSTestNamespaceConst();
+}
+
+JSC::GCClient::IsoSubspace* JSTestNamespaceConst::subspaceForImpl(JSC::VM& vm)
+{
+    return WebCore::subspaceForImpl<JSTestNamespaceConst, UseCustomHeapCellType::No>(vm,
+        [] (auto& spaces) { return spaces.m_clientSubspaceForTestNamespaceConst.get(); },
+        [] (auto& spaces, auto&& space) { spaces.m_clientSubspaceForTestNamespaceConst = WTFMove(space); },
+        [] (auto& spaces) { return spaces.m_subspaceForTestNamespaceConst.get(); },
+        [] (auto& spaces, auto&& space) { spaces.m_subspaceForTestNamespaceConst = WTFMove(space); }
+    );
+}
+
+
+}

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamespaceConst.h (0 => 290845)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamespaceConst.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamespaceConst.h	2022-03-04 22:08:20 UTC (rev 290845)
@@ -0,0 +1,62 @@
+/*
+    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"
+
+namespace WebCore {
+
+class JSTestNamespaceConst : public JSDOMObject {
+public:
+    using Base = JSDOMObject;
+    static JSTestNamespaceConst* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject)
+    {
+        JSTestNamespaceConst* ptr = new (NotNull, JSC::allocateCell<JSTestNamespaceConst>(globalObject->vm())) JSTestNamespaceConst(structure, *globalObject);
+        ptr->finishCreation(globalObject->vm());
+        return ptr;
+    }
+
+    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(), JSC::NonArray);
+    }
+
+    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    template<typename, JSC::SubspaceAccess mode> static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm)
+    {
+        if constexpr (mode == JSC::SubspaceAccess::Concurrently)
+            return nullptr;
+        return subspaceForImpl(vm);
+    }
+    static JSC::GCClient::IsoSubspace* subspaceForImpl(JSC::VM& vm);
+protected:
+    JSTestNamespaceConst(JSC::Structure*, JSDOMGlobalObject&);
+
+    void finishCreation(JSC::VM&);
+};
+
+
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep (290844 => 290845)


--- trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep	2022-03-04 21:58:40 UTC (rev 290844)
+++ trunk/Source/WebCore/bindings/scripts/test/SupplementalDependencies.dep	2022-03-04 22:08:20 UTC (rev 290845)
@@ -86,6 +86,7 @@
 JSTestNamedSetterWithLegacyOverrideBuiltIns.h: 
 JSTestNamedSetterWithLegacyUnforgeableProperties.h: 
 JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.h: 
+JSTestNamespaceConst.h: 
 JSTestNamespaceObject.h: TestPartialNamespaceObject.idl
 TestPartialNamespaceObject.idl:
 JSTestNode.h: 

Added: trunk/Source/WebCore/bindings/scripts/test/TestNamespaceConst.idl (0 => 290845)


--- trunk/Source/WebCore/bindings/scripts/test/TestNamespaceConst.idl	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestNamespaceConst.idl	2022-03-04 22:08:20 UTC (rev 290845)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. 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.
+ */
+
+// This IDL file is for testing the bindings code generator and for tracking
+// changes in its output.
+[
+    Exposed=TestGlobalObject,
+] namespace TestNamespaceConst {
+    const boolean TEST_FLAG = false;
+    const unsigned long TEST_BIT_MASK = 0x0000fc00;
+};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to