https://bugs.webkit.org/show_bug.cgi?id=150438
Reviewed by Darin Adler.
Binding generator is now deducing that function/attribute is JSBuiltin if the interface is marked as JSBuiltin.
One exception is custom setters, getters or functions which remain C++ handled.
Updated streams API IDLs accordingly.
Binding generator knows whether class needs a DOM class by checking whether the interface is marked as JSBuiltin.
Binding generator knows that class uses a JS built-in constructor if marked as JSBuiltin+Constructor.
In particular, JSBuiltIn+CustomConstructor means that a DOM class is not needed and constructor is not JS built-in.
Applied JSBuiltin+CustomConstructor to ReadableStreamReader and ReadableStreamController.
Removing ReadableStreamReader and ReadableStreamController classes.
Removed unneeded "Default" keyword for cancel function in WebIDL.
Added a binding test case.
No change in behavior.
* Modules/streams/ByteLengthQueuingStrategy.idl: Marking interface as JSBuiltin and Constructable.
* Modules/streams/CountQueuingStrategy.idl: Ditto.
* Modules/streams/ReadableStream.idl: Ditto.
* Modules/streams/ReadableStreamController.h: Removed.
* Modules/streams/ReadableStreamController.idl: Marking interface as JSBuiltin and Constructable.
* Modules/streams/ReadableStreamReader.h: Removed.
* Modules/streams/ReadableStreamReader.idl: Marking interface as JSBuiltin and Constructable.
* Modules/streams/WritableStream.idl: Ditto.
* bindings/js/JSReadableStreamPrivateConstructors.cpp:
(WebCore::JSBuiltinReadableStreamReaderPrivateConstructor::createJSObject): Updated according new constructor.
(WebCore::JSBuiltinReadableStreamControllerPrivateConstructor::createJSObject): Ditto.
* bindings/scripts/CodeGeneratorJS.pm:
(NeedsImplementationClass):
(GetAttributeGetterName):
(GetAttributeSetterName):
(GetFunctionName):
(InstanceNeedsVisitChildren):
(GenerateHeader):
(GenerateAttributesHashTable):
(GenerateImplementation):
(GetConstructorTemplateClassName):
(GenerateConstructorDefinition):
(GenerateConstructorHelperMethods):
(IsConstructable):
(ComputeFunctionSpecial):
(IsJSBuiltin):
(IsJSBuiltinConstructor):
(AddJSBuiltinIncludesIfNeeded):
(GetJSBuiltinFunctionName): Deleted.
(GetJSBuiltinFunctionNameFromString): Deleted.
(GetJSBuiltinScopeName): Deleted.
* bindings/scripts/test/GObject/WebKitDOMTestJSBuiltinConstructor.cpp:
(webkit_dom_test_js_builtin_constructor_set_property):
(webkit_dom_test_js_builtin_constructor_get_property):
(webkit_dom_test_js_builtin_constructor_class_init):
(webkit_dom_test_js_builtin_constructor_test_function):
(webkit_dom_test_js_builtin_constructor_get_test_attribute):
(webkit_dom_test_js_builtin_constructor_set_test_attribute):
* bindings/scripts/test/GObject/WebKitDOMTestJSBuiltinConstructor.h:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::JSTestJSBuiltinConstructor::JSTestJSBuiltinConstructor):
(WebCore::JSTestJSBuiltinConstructor::getOwnPropertySlot):
(WebCore::jsTestJSBuiltinConstructorTestAttribute):
(WebCore::jsTestJSBuiltinConstructorTestAttributeCustom):
(WebCore::jsTestJSBuiltinConstructorTestAttributeRWCustom):
(WebCore::setJSTestJSBuiltinConstructorTestAttribute):
(WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustom):
(WebCore::jsTestJSBuiltinConstructorPrototypeFunctionTestFunction):
(WebCore::jsTestJSBuiltinConstructorPrototypeFunctionTestCustomFunction):
(WebCore::JSTestJSBuiltinConstructorOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestJSBuiltinConstructorOwner::finalize):
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
(WebCore::JSTestJSBuiltinConstructor::toWrapped):
(WebCore::JSTestJSBuiltinConstructorPrototype::createStructure): Deleted.
(WebCore::JSTestJSBuiltinConstructorConstructor::initializeProperties): Deleted.
(WebCore::JSTestJSBuiltinConstructor::createPrototype): Deleted.
(WebCore::JSTestJSBuiltinConstructor::getPrototype): Deleted.
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
(WebCore::JSTestJSBuiltinConstructor::create):
(WebCore::JSTestJSBuiltinConstructor::finishCreation):
(WebCore::wrapperOwner):
(WebCore::toJS):
(WebCore::JSTestJSBuiltinConstructor::createStructure): Deleted.
* bindings/scripts/test/ObjC/DOMTestJSBuiltinConstructor.h:
* bindings/scripts/test/ObjC/DOMTestJSBuiltinConstructor.mm:
(-[DOMTestJSBuiltinConstructor testAttribute]):
(-[DOMTestJSBuiltinConstructor setTestAttribute:]):
(-[DOMTestJSBuiltinConstructor testAttributeCustom]):
(-[DOMTestJSBuiltinConstructor testAttributeRWCustom]):
(-[DOMTestJSBuiltinConstructor setTestAttributeRWCustom:]):
(-[DOMTestJSBuiltinConstructor testFunction]):
(-[DOMTestJSBuiltinConstructor testCustomFunction]):
* bindings/scripts/test/TestJSBuiltinConstructor.idl:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191885
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-11-02 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
+ IDL functions and attributes should be JSBuiltin by default if interface is marked as JSBuiltinConstructor
+ https://bugs.webkit.org/show_bug.cgi?id=150438
+
+ Reviewed by Darin Adler.
+
+ Binding generator is now deducing that function/attribute is JSBuiltin if the interface is marked as JSBuiltin.
+ One exception is custom setters, getters or functions which remain C++ handled.
+ Updated streams API IDLs accordingly.
+
+ Binding generator knows whether class needs a DOM class by checking whether the interface is marked as JSBuiltin.
+ Binding generator knows that class uses a JS built-in constructor if marked as JSBuiltin+Constructor.
+ In particular, JSBuiltIn+CustomConstructor means that a DOM class is not needed and constructor is not JS built-in.
+
+ Applied JSBuiltin+CustomConstructor to ReadableStreamReader and ReadableStreamController.
+ Removing ReadableStreamReader and ReadableStreamController classes.
+
+ Removed unneeded "Default" keyword for cancel function in WebIDL.
+
+ Added a binding test case.
+ No change in behavior.
+
+ * Modules/streams/ByteLengthQueuingStrategy.idl: Marking interface as JSBuiltin and Constructable.
+ * Modules/streams/CountQueuingStrategy.idl: Ditto.
+ * Modules/streams/ReadableStream.idl: Ditto.
+ * Modules/streams/ReadableStreamController.h: Removed.
+ * Modules/streams/ReadableStreamController.idl: Marking interface as JSBuiltin and Constructable.
+ * Modules/streams/ReadableStreamReader.h: Removed.
+ * Modules/streams/ReadableStreamReader.idl: Marking interface as JSBuiltin and Constructable.
+ * Modules/streams/WritableStream.idl: Ditto.
+ * bindings/js/JSReadableStreamPrivateConstructors.cpp:
+ (WebCore::JSBuiltinReadableStreamReaderPrivateConstructor::createJSObject): Updated according new constructor.
+ (WebCore::JSBuiltinReadableStreamControllerPrivateConstructor::createJSObject): Ditto.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (NeedsImplementationClass):
+ (GetAttributeGetterName):
+ (GetAttributeSetterName):
+ (GetFunctionName):
+ (InstanceNeedsVisitChildren):
+ (GenerateHeader):
+ (GenerateAttributesHashTable):
+ (GenerateImplementation):
+ (GetConstructorTemplateClassName):
+ (GenerateConstructorDefinition):
+ (GenerateConstructorHelperMethods):
+ (IsConstructable):
+ (ComputeFunctionSpecial):
+ (IsJSBuiltin):
+ (IsJSBuiltinConstructor):
+ (AddJSBuiltinIncludesIfNeeded):
+ (GetJSBuiltinFunctionName): Deleted.
+ (GetJSBuiltinFunctionNameFromString): Deleted.
+ (GetJSBuiltinScopeName): Deleted.
+ * bindings/scripts/test/GObject/WebKitDOMTestJSBuiltinConstructor.cpp:
+ (webkit_dom_test_js_builtin_constructor_set_property):
+ (webkit_dom_test_js_builtin_constructor_get_property):
+ (webkit_dom_test_js_builtin_constructor_class_init):
+ (webkit_dom_test_js_builtin_constructor_test_function):
+ (webkit_dom_test_js_builtin_constructor_get_test_attribute):
+ (webkit_dom_test_js_builtin_constructor_set_test_attribute):
+ * bindings/scripts/test/GObject/WebKitDOMTestJSBuiltinConstructor.h:
+ * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
+ (WebCore::JSTestJSBuiltinConstructor::JSTestJSBuiltinConstructor):
+ (WebCore::JSTestJSBuiltinConstructor::getOwnPropertySlot):
+ (WebCore::jsTestJSBuiltinConstructorTestAttribute):
+ (WebCore::jsTestJSBuiltinConstructorTestAttributeCustom):
+ (WebCore::jsTestJSBuiltinConstructorTestAttributeRWCustom):
+ (WebCore::setJSTestJSBuiltinConstructorTestAttribute):
+ (WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustom):
+ (WebCore::jsTestJSBuiltinConstructorPrototypeFunctionTestFunction):
+ (WebCore::jsTestJSBuiltinConstructorPrototypeFunctionTestCustomFunction):
+ (WebCore::JSTestJSBuiltinConstructorOwner::isReachableFromOpaqueRoots):
+ (WebCore::JSTestJSBuiltinConstructorOwner::finalize):
+ (WebCore::toJSNewlyCreated):
+ (WebCore::toJS):
+ (WebCore::JSTestJSBuiltinConstructor::toWrapped):
+ (WebCore::JSTestJSBuiltinConstructorPrototype::createStructure): Deleted.
+ (WebCore::JSTestJSBuiltinConstructorConstructor::initializeProperties): Deleted.
+ (WebCore::JSTestJSBuiltinConstructor::createPrototype): Deleted.
+ (WebCore::JSTestJSBuiltinConstructor::getPrototype): Deleted.
+ * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
+ (WebCore::JSTestJSBuiltinConstructor::create):
+ (WebCore::JSTestJSBuiltinConstructor::finishCreation):
+ (WebCore::wrapperOwner):
+ (WebCore::toJS):
+ (WebCore::JSTestJSBuiltinConstructor::createStructure): Deleted.
+ * bindings/scripts/test/ObjC/DOMTestJSBuiltinConstructor.h:
+ * bindings/scripts/test/ObjC/DOMTestJSBuiltinConstructor.mm:
+ (-[DOMTestJSBuiltinConstructor testAttribute]):
+ (-[DOMTestJSBuiltinConstructor setTestAttribute:]):
+ (-[DOMTestJSBuiltinConstructor testAttributeCustom]):
+ (-[DOMTestJSBuiltinConstructor testAttributeRWCustom]):
+ (-[DOMTestJSBuiltinConstructor setTestAttributeRWCustom:]):
+ (-[DOMTestJSBuiltinConstructor testFunction]):
+ (-[DOMTestJSBuiltinConstructor testCustomFunction]):
+ * bindings/scripts/test/TestJSBuiltinConstructor.idl:
+
2015-10-29 Sergio Villar Senin <svillar@igalia.com>
[CSS Grid Layout] min-content row does not always shrink
*/
[
- JSBuiltinConstructor,
+ JSBuiltin,
+ Constructor,
Conditional=STREAMS_API,
] interface ByteLengthQueuingStrategy {
- [JSBuiltin] double size();
+ double size();
};
*/
[
- JSBuiltinConstructor,
+ JSBuiltin,
+ Constructor,
Conditional=STREAMS_API,
] interface CountQueuingStrategy {
- [JSBuiltin] double size();
+ double size();
};
[
Conditional=STREAMS_API,
- JSBuiltinConstructor
+ Constructor,
+ JSBuiltin
] interface ReadableStream {
- [JSBuiltin] Promise cancel([Default=Undefined] optional any reason);
- [JSBuiltin] Object getReader();
- [JSBuiltin] Promise pipeTo(any streams, any options);
- [JSBuiltin] Object pipeThrough(any dest, any options);
- [JSBuiltin] Object tee();
+ Promise cancel(optional any reason);
+ Object getReader();
+ Promise pipeTo(any streams, any options);
+ Object pipeThrough(any dest, any options);
+ Object tee();
- [JSBuiltin] readonly attribute boolean locked;
+ readonly attribute boolean locked;
};
+++ /dev/null
-/*
- * Copyright (C) 2015 Canon Inc.
- * Copyright (C) 2015 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted, provided that the following conditions
- * are required to be 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 Canon Inc. 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 CANON 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 CANON INC. AND 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.
- */
-
-#ifndef ReadableStreamController_h
-#define ReadableStreamController_h
-
-#if ENABLE(STREAMS_API)
-
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-// This is a dummy class needed as we cannot yet use JSBuiltinConstructor with NoInterfaceObject.
-// Implementation of ReadableStreamController functionality is done in ReadableStreamController.js
-// FIXME: Find a way to remove that class.
-class ReadableStreamController final : public RefCounted<ReadableStreamController> {
-public:
- static Ref<ReadableStreamController> create() { return adoptRef(* new ReadableStreamController); }
-private:
- ReadableStreamController() { }
-};
-
-}
-
-#endif
-
-#endif // ReadableStream_h
[
Conditional=STREAMS_API,
CustomConstructor,
- ImplementationLacksVTable,
+ JSBuiltin,
NoInterfaceObject
] interface ReadableStreamController {
- [JSBuiltin] void enqueue([Default=Undefined] optional any chunk);
- [JSBuiltin] void close();
- [JSBuiltin] void error([Default=Undefined] optional any error);
+ void enqueue(optional any chunk);
+ void close();
+ void error(optional any error);
- [JSBuiltin] readonly attribute double desiredSize;
+ readonly attribute double desiredSize;
};
+++ /dev/null
-/*
- * Copyright (C) 2015 Canon Inc.
- * Copyright (C) 2015 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted, provided that the following conditions
- * are required to be 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 Canon Inc. 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 CANON 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 CANON INC. AND 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.
- */
-
-#ifndef ReadableStreamReader_h
-#define ReadableStreamReader_h
-
-#if ENABLE(STREAMS_API)
-
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-// This is a dummy class needed as we cannot yet use JSBuiltinConstructor with NoInterfaceObject.
-// Implementation of ReadableStreamReader functionality is done in ReadableStreamReader.js
-// FIXME: Find a way to remove that class.
-class ReadableStreamReader final : public RefCounted<ReadableStreamReader> {
-public:
- static Ref<ReadableStreamReader> create() { return adoptRef(* new ReadableStreamReader); }
-private:
- ReadableStreamReader() { }
-};
-
-}
-
-#endif
-
-#endif // ReadableStream_h
[
Conditional=STREAMS_API,
CustomConstructor,
- ImplementationLacksVTable,
+ JSBuiltin,
NoInterfaceObject
] interface ReadableStreamReader {
- [JSBuiltin] Promise read();
- [JSBuiltin] Promise cancel([Default=Undefined] optional any reason);
- [JSBuiltin] void releaseLock();
+ Promise read();
+ Promise cancel(optional any reason);
+ void releaseLock();
- [JSBuiltin] readonly attribute Promise closed;
+ readonly attribute Promise closed;
};
[
Conditional=STREAMS_API,
- JSBuiltinConstructor
+ Constructor,
+ JSBuiltin
] interface WritableStream {
- [JSBuiltin] Promise abort([Default=Undefined] optional any reason);
- [JSBuiltin] Promise close();
- [JSBuiltin] Promise write(any chunk);
+ Promise abort(optional any reason);
+ Promise close();
+ Promise write(any chunk);
- [JSBuiltin] readonly attribute Promise closed;
- [JSBuiltin] readonly attribute Promise ready;
- [JSBuiltin] readonly attribute DOMString state;
+ readonly attribute Promise closed;
+ readonly attribute Promise ready;
+ readonly attribute DOMString state;
};
template<> JSObject* JSBuiltinReadableStreamReaderPrivateConstructor::createJSObject()
{
- return JSReadableStreamReader::create(getDOMStructure<JSReadableStreamReader>(globalObject()->vm(), *globalObject()), globalObject(), ReadableStreamReader::create());
+ return JSReadableStreamReader::create(getDOMStructure<JSReadableStreamReader>(globalObject()->vm(), *globalObject()), globalObject());
}
template<> JSObject* JSBuiltinReadableStreamControllerPrivateConstructor::createJSObject()
{
- return JSReadableStreamController::create(getDOMStructure<JSReadableStreamController>(globalObject()->vm(), *globalObject()), globalObject(), ReadableStreamController::create());
+ return JSReadableStreamController::create(getDOMStructure<JSReadableStreamController>(globalObject()->vm(), *globalObject()), globalObject());
}
template<> FunctionExecutable* JSBuiltinReadableStreamReaderPrivateConstructor::initializeExecutable(JSC::VM& vm)
{
my ($interface) = @_;
- return 0 if ($interface->extendedAttributes->{"JSBuiltinConstructor"});
+ return 0 if ($interface->extendedAttributes->{"JSBuiltin"});
return 1;
}
sub GetAttributeGetterName
{
- my ($interfaceName, $className, $attribute) = @_;
+ my ($interfaceName, $className, $interface, $attribute) = @_;
if ($attribute->isStatic) {
return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name);
}
- if ($attribute->signature->extendedAttributes->{"JSBuiltin"}) {
+ if (IsJSBuiltin($interface, $attribute)) {
return GetJSBuiltinFunctionName($className, $attribute);
}
return "js" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
sub GetAttributeSetterName
{
- my ($interfaceName, $className, $attribute) = @_;
+ my ($interfaceName, $className, $interface, $attribute) = @_;
if ($attribute->isStatic) {
return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->signature->name);
}
- if ($attribute->signature->extendedAttributes->{"JSBuiltin"}) {
+ if (IsJSBuiltin($interface, $attribute)) {
return "set" . $codeGenerator->WK_ucfirst(GetJSBuiltinFunctionName($className, $attribute));
}
return "setJS" . $interfaceName . $codeGenerator->WK_ucfirst($attribute->signature->name) . ($attribute->signature->type =~ /Constructor$/ ? "Constructor" : "");
sub GetFunctionName
{
- my ($className, $function) = @_;
+ my ($interface, $className, $function) = @_;
- if ($function->signature->extendedAttributes->{"JSBuiltin"}) {
+ if (IsJSBuiltin($interface, $function)) {
return GetJSBuiltinFunctionName($className, $function);
}
|| $interface->extendedAttributes->{"EventTarget"}
|| $interface->name eq "EventTarget"
|| $interface->extendedAttributes->{"ReportExtraMemoryCost"}
- || $interface->extendedAttributes->{"JSBuiltinConstructor"};
+ || IsJSBuiltinConstructor($interface)
}
sub GetImplClassName
my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
- my $functionName = GetFunctionName($className, $function);
+ my $functionName = GetFunctionName($interface, $className, $function);
push(@headerContent, "JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n");
push(@headerContent, "#endif\n") if $conditionalString;
}
my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
- my $getter = GetAttributeGetterName($interfaceName, $className, $attribute);
+ my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
push(@headerContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);\n");
if (!IsReadonly($attribute)) {
- my $setter = GetAttributeSetterName($interfaceName, $className, $attribute);
+ my $setter = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
push(@headerContent, "void ${setter}(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);\n");
}
push(@headerContent, "#endif\n") if $conditionalString;
push(@specials, "DontEnum") if ($attribute->signature->extendedAttributes->{"NotEnumerable"} || $is_global_constructor);
push(@specials, "ReadOnly") if IsReadonly($attribute);
- push(@specials, "CustomAccessor") unless $is_global_constructor or $attribute->signature->extendedAttributes->{"JSBuiltin"};
- push(@specials, "Accessor | Builtin") if $attribute->signature->extendedAttributes->{"JSBuiltin"};
+ push(@specials, "CustomAccessor") unless $is_global_constructor or IsJSBuiltin($interface, $attribute);
+ push(@specials, "Accessor | Builtin") if IsJSBuiltin($interface, $attribute);
my $special = (@specials > 0) ? join(" | ", @specials) : "0";
push(@$hashSpecials, $special);
- my $getter = GetAttributeGetterName($interfaceName, $className, $attribute);
+ my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
push(@$hashValue1, $getter);
if (IsReadonly($attribute)) {
push(@$hashValue2, "0");
} else {
- my $setter = GetAttributeSetterName($interfaceName, $className, $attribute);
+ my $setter = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
push(@$hashValue2, $setter);
}
next if $function->{overloadIndex} && $function->{overloadIndex} > 1;
next if $function->signature->extendedAttributes->{"ForwardDeclareInHeader"};
next if $function->signature->extendedAttributes->{"CustomBinding"};
- next if $function->signature->extendedAttributes->{"JSBuiltin"};
+ next if IsJSBuiltin($interface, $function);
my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
if ($needsAppleCopyright) {
my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
- my $functionName = GetFunctionName($className, $function);
+ my $functionName = GetFunctionName($interface, $className, $function);
push(@implContent, "JSC::EncodedJSValue JSC_HOST_CALL ${functionName}(JSC::ExecState*);\n");
push(@implContent, "#endif\n") if $conditionalString;
}
push(@implContent, "// Attributes\n\n");
foreach my $attribute (@{$interface->attributes}) {
next if $attribute->signature->extendedAttributes->{"ForwardDeclareInHeader"};
- next if $attribute->signature->extendedAttributes->{"JSBuiltin"};
+ next if IsJSBuiltin($interface, $attribute);
my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
- my $getter = GetAttributeGetterName($interfaceName, $className, $attribute);
+ my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
push(@implContent, "JSC::EncodedJSValue ${getter}(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);\n");
if (!IsReadonly($attribute)) {
- my $setter = GetAttributeSetterName($interfaceName, $className, $attribute);
+ my $setter = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
push(@implContent, "void ${setter}(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);\n");
}
push(@implContent, "#endif\n") if $conditionalString;
my $special = (@specials > 0) ? join(" | ", @specials) : "0";
push(@hashSpecials, $special);
- my $getter = GetAttributeGetterName($interfaceName, $className, $attribute);
+ my $getter = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
push(@hashValue1, $getter);
if (IsReadonly($attribute)) {
push(@hashValue2, "0");
} else {
- my $setter = GetAttributeSetterName($interfaceName, $className, $attribute);
+ my $setter = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
push(@hashValue2, $setter);
}
my $name = $function->signature->name;
push(@hashKeys, $name);
- my $functionName = GetFunctionName($className, $function);
+ my $functionName = GetFunctionName($interface, $className, $function);
push(@hashValue1, $functionName);
my $functionLength = GetFunctionLength($function);
my $name = $function->signature->name;
push(@hashKeys, $name);
- my $functionName = GetFunctionName($className, $function);
+ my $functionName = GetFunctionName($interface, $className, $function);
push(@hashValue1, $functionName);
my $functionLength = GetFunctionLength($function);
AddToImplIncludes("WebCoreJSClientData.h");
push(@implContent, " JSVMClientData& clientData = *static_cast<JSVMClientData*>(vm.clientData);\n") if $firstPrivateFunction;
$firstPrivateFunction = 0;
- push(@implContent, " putDirect(vm, clientData.builtinNames()." . $function->signature->name . "PrivateName(), JSFunction::create(vm, globalObject(), 0, String(), " . GetFunctionName($className, $function) . "), ReadOnly | DontEnum);\n");
+ push(@implContent, " putDirect(vm, clientData.builtinNames()." . $function->signature->name . "PrivateName(), JSFunction::create(vm, globalObject(), 0, String(), " . GetFunctionName($interface, $className, $function) . "), ReadOnly | DontEnum);\n");
}
push(@implContent, "}\n\n");
$numAttributes = $numAttributes + 1 if NeedsConstructorProperty($interface);
if ($numAttributes > 0) {
foreach my $attribute (@{$interface->attributes}) {
- next if $attribute->signature->extendedAttributes->{"JSBuiltin"};
+ next if IsJSBuiltin($interface, $attribute);
my $name = $attribute->signature->name;
my $type = $attribute->signature->type;
# Nullable wrapper types do not need any special handling as the implementation can return a null pointer.
my $isNullable = $attribute->signature->isNullable && !$codeGenerator->IsWrapperType($type);
$codeGenerator->AssertNotSequenceType($type);
- my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $attribute);
+ my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $interface, $attribute);
my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{"ImplementedAs"} || $name);
my $getterExceptions = $attribute->signature->extendedAttributes->{"GetterRaisesException"};
foreach my $attribute (@{$interface->attributes}) {
if (!IsReadonly($attribute)) {
- next if $attribute->signature->extendedAttributes->{"JSBuiltin"};
+ next if IsJSBuiltin($interface, $attribute);
my $name = $attribute->signature->name;
my $type = $attribute->signature->type;
- my $putFunctionName = GetAttributeSetterName($interfaceName, $className, $attribute);
+ my $putFunctionName = GetAttributeSetterName($interfaceName, $className, $interface, $attribute);
my $implSetterFunctionName = $codeGenerator->WK_ucfirst($name);
my $setterRaisesException = $attribute->signature->extendedAttributes->{"SetterRaisesException"};
my $inAppleCopyright = 0;
foreach my $function (@{$interface->functions}) {
next if $function->signature->extendedAttributes->{"CustomBinding"};
- next if $function->signature->extendedAttributes->{"JSBuiltin"};
+ next if IsJSBuiltin($interface, $function);
my $needsAppleCopyright = $function->signature->extendedAttributes->{"AppleCopyright"};
if ($needsAppleCopyright) {
if (!$inAppleCopyright) {
AddIncludesForTypeInImpl($function->signature->type) unless $isCustom or IsReturningPromise($function);
- my $functionName = GetFunctionName($className, $function);
+ my $functionName = GetFunctionName($interface, $className, $function);
my $conditional = $function->signature->extendedAttributes->{"Conditional"};
if ($conditional) {
sub GetConstructorTemplateClassName
{
my $interface = shift;
- return "JSBuiltinConstructor" if ($interface->extendedAttributes->{"JSBuiltinConstructor"});
return "JSDOMConstructorNotConstructable" if ($interface->extendedAttributes->{"NamedConstructor"});
return "JSDOMConstructorNotConstructable" unless IsConstructable($interface);
+ return "JSBuiltinConstructor" if IsJSBuiltinConstructor($interface);
return "JSDOMConstructor";
}
my $generatingNamedConstructor = shift;
my $function = shift;
- return if ($interface->extendedAttributes->{"JSBuiltinConstructor"});
+ return if IsJSBuiltinConstructor($interface);
my $constructorClassName = $generatingNamedConstructor ? "${className}NamedConstructor" : "${className}Constructor";
push(@$outputArray, "\n");
}
- if ($interface->extendedAttributes->{"JSBuiltinConstructor"}) {
+ if (IsJSBuiltinConstructor($interface)) {
push(@$outputArray, "template<> FunctionExecutable* ${constructorClassName}::initializeExecutable(VM& vm)\n");
push(@$outputArray, "{\n");
push(@$outputArray, " return " . GetJSBuiltinFunctionNameFromString($interfaceName, "initialize" . $interfaceName) . "(vm);\n");
{
my $interface = shift;
- return HasCustomConstructor($interface) || $interface->extendedAttributes->{"Constructor"} || $interface->extendedAttributes->{"NamedConstructor"} || $interface->extendedAttributes->{"ConstructorTemplate"} || $interface->extendedAttributes->{"JSBuiltinConstructor"};
+ return HasCustomConstructor($interface) || $interface->extendedAttributes->{"Constructor"} || $interface->extendedAttributes->{"NamedConstructor"} || $interface->extendedAttributes->{"ConstructorTemplate"};
}
sub HeaderNeedsPrototypeDeclaration
push(@specials, "DontDelete") if $function->signature->extendedAttributes->{"Unforgeable"}
|| $interface->extendedAttributes->{"Unforgeable"};
push(@specials, "DontEnum") if $function->signature->extendedAttributes->{"NotEnumerable"};
- if ($function->signature->extendedAttributes->{"JSBuiltin"}) {
+ if (IsJSBuiltin($interface, $function)) {
push(@specials, "JSC::Builtin");
}
else {
return (@specials > 0) ? join(" | ", @specials) : "0";
}
+sub IsJSBuiltin
+{
+ my ($interface, $object) = @_;
+
+ return 0 if $object->signature->extendedAttributes->{"Custom"};
+ return 0 if $object->signature->extendedAttributes->{"CustomGetter"};
+ return 0 if $object->signature->extendedAttributes->{"CustomSetter"};
+
+ return 1 if $object->signature->extendedAttributes->{"JSBuiltin"};
+ return 1 if $interface->extendedAttributes->{"JSBuiltin"};
+
+ return 0;
+}
+
+sub IsJSBuiltinConstructor
+{
+ my ($interface) = @_;
+
+ return 0 if $interface->extendedAttributes->{"CustomConstructor"};
+ return 1 if $interface->extendedAttributes->{"JSBuiltin"};
+ return 0;
+}
+
sub GetJSBuiltinFunctionName
{
my ($className, $function) = @_;
{
my $interface = shift;
- if ($interface->extendedAttributes->{"JSBuiltinConstructor"}) {
+ if ($interface->extendedAttributes->{"JSBuiltin"}) {
AddToImplIncludes($interface->name . "Builtins.h");
return;
}
foreach my $function (@{$interface->functions}) {
- AddToImplIncludes(GetJSBuiltinScopeName($interface, $function) . "Builtins.h", $function->signature->extendedAttributes->{"Conditional"}) if $function->signature->extendedAttributes->{"JSBuiltin"};
+ AddToImplIncludes(GetJSBuiltinScopeName($interface, $function) . "Builtins.h", $function->signature->extendedAttributes->{"Conditional"}) if IsJSBuiltin($interface, $function);
}
foreach my $attribute (@{$interface->attributes}) {
- AddToImplIncludes(GetJSBuiltinScopeName($interface, $attribute) . "Builtins.h", $attribute->signature->extendedAttributes->{"Conditional"}) if $attribute->signature->extendedAttributes->{"JSBuiltin"};
+ AddToImplIncludes(GetJSBuiltinScopeName($interface, $attribute) . "Builtins.h", $attribute->signature->extendedAttributes->{"Conditional"}) if IsJSBuiltin($interface, $attribute);
}
}
G_DEFINE_TYPE(WebKitDOMTestJSBuiltinConstructor, webkit_dom_test_js_builtin_constructor, WEBKIT_DOM_TYPE_OBJECT)
+enum {
+ PROP_0,
+ PROP_TEST_ATTRIBUTE,
+};
+
static void webkit_dom_test_js_builtin_constructor_finalize(GObject* object)
{
WebKitDOMTestJSBuiltinConstructorPrivate* priv = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(object);
G_OBJECT_CLASS(webkit_dom_test_js_builtin_constructor_parent_class)->finalize(object);
}
+static void webkit_dom_test_js_builtin_constructor_set_property(GObject* object, guint propertyId, const GValue* value, GParamSpec* pspec)
+{
+ WebKitDOMTestJSBuiltinConstructor* self = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR(object);
+
+ switch (propertyId) {
+ case PROP_TEST_ATTRIBUTE:
+ webkit_dom_test_js_builtin_constructor_set_test_attribute(self, g_value_get_boolean(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
+ break;
+ }
+}
+
+static void webkit_dom_test_js_builtin_constructor_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec)
+{
+ WebKitDOMTestJSBuiltinConstructor* self = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR(object);
+
+ switch (propertyId) {
+ case PROP_TEST_ATTRIBUTE:
+ g_value_set_boolean(value, webkit_dom_test_js_builtin_constructor_get_test_attribute(self));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec);
+ break;
+ }
+}
+
static GObject* webkit_dom_test_js_builtin_constructor_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
{
GObject* object = G_OBJECT_CLASS(webkit_dom_test_js_builtin_constructor_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestJSBuiltinConstructorPrivate));
gobjectClass->constructor = webkit_dom_test_js_builtin_constructor_constructor;
gobjectClass->finalize = webkit_dom_test_js_builtin_constructor_finalize;
+ gobjectClass->set_property = webkit_dom_test_js_builtin_constructor_set_property;
+ gobjectClass->get_property = webkit_dom_test_js_builtin_constructor_get_property;
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_TEST_ATTRIBUTE,
+ g_param_spec_boolean(
+ "test-attribute",
+ "TestJSBuiltinConstructor:test-attribute",
+ "read-write gboolean TestJSBuiltinConstructor:test-attribute",
+ FALSE,
+ WEBKIT_PARAM_READWRITE));
+
}
static void webkit_dom_test_js_builtin_constructor_init(WebKitDOMTestJSBuiltinConstructor* request)
new (priv) WebKitDOMTestJSBuiltinConstructorPrivate();
}
+void webkit_dom_test_js_builtin_constructor_test_function(WebKitDOMTestJSBuiltinConstructor* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_JS_BUILTIN_CONSTRUCTOR(self));
+ WebCore::TestJSBuiltinConstructor* item = WebKit::core(self);
+ item->testFunction();
+}
+
+gboolean webkit_dom_test_js_builtin_constructor_get_test_attribute(WebKitDOMTestJSBuiltinConstructor* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_JS_BUILTIN_CONSTRUCTOR(self), FALSE);
+ WebCore::TestJSBuiltinConstructor* item = WebKit::core(self);
+ gboolean result = item->testAttribute();
+ return result;
+}
+
+void webkit_dom_test_js_builtin_constructor_set_test_attribute(WebKitDOMTestJSBuiltinConstructor* self, gboolean value)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_JS_BUILTIN_CONSTRUCTOR(self));
+ WebCore::TestJSBuiltinConstructor* item = WebKit::core(self);
+ item->setTestAttribute(value);
+}
+
WEBKIT_API GType
webkit_dom_test_js_builtin_constructor_get_type(void);
+/**
+ * webkit_dom_test_js_builtin_constructor_test_function:
+ * @self: A #WebKitDOMTestJSBuiltinConstructor
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_js_builtin_constructor_test_function(WebKitDOMTestJSBuiltinConstructor* self);
+
+/**
+ * webkit_dom_test_js_builtin_constructor_get_test_attribute:
+ * @self: A #WebKitDOMTestJSBuiltinConstructor
+ *
+ * Returns: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gboolean
+webkit_dom_test_js_builtin_constructor_get_test_attribute(WebKitDOMTestJSBuiltinConstructor* self);
+
+/**
+ * webkit_dom_test_js_builtin_constructor_set_test_attribute:
+ * @self: A #WebKitDOMTestJSBuiltinConstructor
+ * @value: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_js_builtin_constructor_set_test_attribute(WebKitDOMTestJSBuiltinConstructor* self, gboolean value);
+
G_END_DECLS
#endif /* WEBKIT_DOM_USE_UNSTABLE_API */
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "TestJSBuiltinConstructorBuiltins.h"
+#include <runtime/Error.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
+// Functions
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestJSBuiltinConstructorPrototypeFunctionTestCustomFunction(JSC::ExecState*);
+
// Attributes
+JSC::EncodedJSValue jsTestJSBuiltinConstructorTestAttributeCustom(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
+JSC::EncodedJSValue jsTestJSBuiltinConstructorTestAttributeRWCustom(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
+void setJSTestJSBuiltinConstructorTestAttributeRWCustom(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestJSBuiltinConstructorConstructor(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
class JSTestJSBuiltinConstructorPrototype : public JSC::JSNonFinalObject {
typedef JSBuiltinConstructor<JSTestJSBuiltinConstructor> JSTestJSBuiltinConstructorConstructor;
+/* Hash table for constructor */
+
+static const struct CompactHashIndex JSTestJSBuiltinConstructorTableIndex[4] = {
+ { 0, -1 },
+ { -1, -1 },
+ { 1, -1 },
+ { -1, -1 },
+};
+
+
+static const HashTableValue JSTestJSBuiltinConstructorTableValues[] =
+{
+ { "testAttributeCustom", DontDelete | ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSBuiltinConstructorTestAttributeCustom), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
+ { "testAttributeRWCustom", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSBuiltinConstructorTestAttributeRWCustom), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestJSBuiltinConstructorTestAttributeRWCustom) } },
+};
+
+static const HashTable JSTestJSBuiltinConstructorTable = { 2, 3, true, JSTestJSBuiltinConstructorTableValues, JSTestJSBuiltinConstructorTableIndex };
template<> void JSTestJSBuiltinConstructorConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSTestJSBuiltinConstructor::getPrototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
static const HashTableValue JSTestJSBuiltinConstructorPrototypeTableValues[] =
{
{ "constructor", DontEnum | ReadOnly, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestJSBuiltinConstructorConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
+ { "testAttribute", Accessor | Builtin, NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(testJSBuiltinConstructorTestAttributeCodeGenerator), (intptr_t) (setTestJSBuiltinConstructorTestAttributeCodeGenerator) } },
+ { "testFunction", JSC::Builtin, NoIntrinsic, { (intptr_t)static_cast<BuiltinGenerator>(testJSBuiltinConstructorTestFunctionCodeGenerator), (intptr_t) (0) } },
+ { "testCustomFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestJSBuiltinConstructorPrototypeFunctionTestCustomFunction), (intptr_t) (0) } },
};
const ClassInfo JSTestJSBuiltinConstructorPrototype::s_info = { "TestJSBuiltinConstructorPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestJSBuiltinConstructorPrototype) };
reifyStaticProperties(vm, JSTestJSBuiltinConstructorPrototypeTableValues, *this);
}
-const ClassInfo JSTestJSBuiltinConstructor::s_info = { "TestJSBuiltinConstructor", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestJSBuiltinConstructor) };
+const ClassInfo JSTestJSBuiltinConstructor::s_info = { "TestJSBuiltinConstructor", &Base::s_info, &JSTestJSBuiltinConstructorTable, CREATE_METHOD_TABLE(JSTestJSBuiltinConstructor) };
JSTestJSBuiltinConstructor::JSTestJSBuiltinConstructor(Structure* structure, JSDOMGlobalObject& globalObject)
: JSDOMObject(structure, globalObject) { }
thisObject->JSTestJSBuiltinConstructor::~JSTestJSBuiltinConstructor();
}
+bool JSTestJSBuiltinConstructor::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
+{
+ auto* thisObject = jsCast<JSTestJSBuiltinConstructor*>(object);
+ ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+ if (getStaticValueSlot<JSTestJSBuiltinConstructor, Base>(state, JSTestJSBuiltinConstructorTable, thisObject, propertyName, slot))
+ return true;
+ return false;
+}
+
+EncodedJSValue jsTestJSBuiltinConstructorTestAttributeCustom(ExecState* state, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(slotBase);
+ UNUSED_PARAM(thisValue);
+ auto* castedThis = jsCast<JSTestJSBuiltinConstructor*>(slotBase);
+ return JSValue::encode(castedThis->testAttributeCustom(*state));
+}
+
+
+EncodedJSValue jsTestJSBuiltinConstructorTestAttributeRWCustom(ExecState* state, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(slotBase);
+ UNUSED_PARAM(thisValue);
+ auto* castedThis = jsCast<JSTestJSBuiltinConstructor*>(slotBase);
+ return JSValue::encode(castedThis->testAttributeRWCustom(*state));
+}
+
+
EncodedJSValue jsTestJSBuiltinConstructorConstructor(ExecState* state, JSObject* baseValue, EncodedJSValue, PropertyName)
{
JSTestJSBuiltinConstructorPrototype* domObject = jsDynamicCast<JSTestJSBuiltinConstructorPrototype*>(baseValue);
return JSValue::encode(JSTestJSBuiltinConstructor::getConstructor(state->vm(), domObject->globalObject()));
}
+void setJSTestJSBuiltinConstructorTestAttributeRWCustom(ExecState* state, JSObject* baseObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ JSValue value = JSValue::decode(encodedValue);
+ UNUSED_PARAM(baseObject);
+ UNUSED_PARAM(thisValue);
+ auto* castedThis = jsCast<JSTestJSBuiltinConstructor*>(baseObject);
+ UNUSED_PARAM(thisValue);
+ UNUSED_PARAM(state);
+ castedThis->setTestAttributeRWCustom(*state, value);
+}
+
+
JSValue JSTestJSBuiltinConstructor::getConstructor(VM& vm, JSGlobalObject* globalObject)
{
return getDOMConstructor<JSTestJSBuiltinConstructorConstructor>(vm, *jsCast<JSDOMGlobalObject*>(globalObject));
}
+EncodedJSValue JSC_HOST_CALL jsTestJSBuiltinConstructorPrototypeFunctionTestCustomFunction(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ JSTestJSBuiltinConstructor* castedThis = jsDynamicCast<JSTestJSBuiltinConstructor*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestJSBuiltinConstructor", "testCustomFunction");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestJSBuiltinConstructor::info());
+ return JSValue::encode(castedThis->testCustomFunction(*state));
+}
+
void JSTestJSBuiltinConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
auto* thisObject = jsCast<JSTestJSBuiltinConstructor*>(cell);
static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
static JSC::JSObject* getPrototype(JSC::VM&, JSC::JSGlobalObject*);
+ static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
static void destroy(JSC::JSCell*);
DECLARE_INFO;
static JSC::JSValue getConstructor(JSC::VM&, JSC::JSGlobalObject*);
static void visitChildren(JSCell*, JSC::SlotVisitor&);
+
+ // Custom attributes
+ JSC::JSValue testAttributeCustom(JSC::ExecState&) const;
+ JSC::JSValue testAttributeRWCustom(JSC::ExecState&) const;
+ void setTestAttributeRWCustom(JSC::ExecState&, JSC::JSValue);
+
+ // Custom functions
+ JSC::JSValue testCustomFunction(JSC::ExecState&);
+public:
+ static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags;
protected:
JSTestJSBuiltinConstructor(JSC::Structure*, JSDOMGlobalObject&);
WEBKIT_CLASS_AVAILABLE_MAC(9876_5)
WEBCORE_EXPORT @interface DOMTestJSBuiltinConstructor : DOMObject
+@property BOOL testAttribute;
+@property (readonly) BOOL testAttributeCustom;
+@property BOOL testAttributeRWCustom;
+
+- (void)testFunction;
+- (void)testCustomFunction;
@end
[super finalize];
}
+- (BOOL)testAttribute
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->testAttribute();
+}
+
+- (void)setTestAttribute:(BOOL)newTestAttribute
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setTestAttribute(newTestAttribute);
+}
+
+- (BOOL)testAttributeCustom
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->testAttributeCustom();
+}
+
+- (BOOL)testAttributeRWCustom
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->testAttributeRWCustom();
+}
+
+- (void)setTestAttributeRWCustom:(BOOL)newTestAttributeRWCustom
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setTestAttributeRWCustom(newTestAttributeRWCustom);
+}
+
+- (void)testFunction
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->testFunction();
+}
+
+- (void)testCustomFunction
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->testCustomFunction();
+}
+
@end
WebCore::TestJSBuiltinConstructor* core(DOMTestJSBuiltinConstructor *wrapper)
[
CustomConstructor,
+ JSBuiltIn,
NoInterfaceObject
] interface TestCustomConstructorWithNoInterfaceObject {
};
*/
[
- JSBuiltinConstructor
+ JSBuiltin,
+ Constructor
] interface TestJSBuiltinConstructor {
-};
+ void testFunction();
+ attribute boolean testAttribute;
+
+ [ Custom ] void testCustomFunction();
+ [ CustomGetter ] readonly attribute boolean testAttributeCustom;
+ [ CustomGetter, CustomSetter ] attribute boolean testAttributeRWCustom;
+
+};