IDL functions and attributes should be JSBuiltin by default if interface is marked...
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Nov 2015 11:00:35 +0000 (11:00 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Nov 2015 11:00:35 +0000 (11:00 +0000)
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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/streams/ByteLengthQueuingStrategy.idl
Source/WebCore/Modules/streams/CountQueuingStrategy.idl
Source/WebCore/Modules/streams/ReadableStream.idl
Source/WebCore/Modules/streams/ReadableStreamController.h [deleted file]
Source/WebCore/Modules/streams/ReadableStreamController.idl
Source/WebCore/Modules/streams/ReadableStreamReader.h [deleted file]
Source/WebCore/Modules/streams/ReadableStreamReader.idl
Source/WebCore/Modules/streams/WritableStream.idl
Source/WebCore/bindings/js/JSReadableStreamPrivateConstructors.cpp
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestJSBuiltinConstructor.cpp
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestJSBuiltinConstructor.h
Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h
Source/WebCore/bindings/scripts/test/ObjC/DOMTestJSBuiltinConstructor.h
Source/WebCore/bindings/scripts/test/ObjC/DOMTestJSBuiltinConstructor.mm
Source/WebCore/bindings/scripts/test/TestCustomConstructor.idl
Source/WebCore/bindings/scripts/test/TestJSBuiltinConstructor.idl

index 2a7104be2af3902bf8d1e2077181cdef5441817c..961a359aec27561d19a8c7699deb1ceaa19ca736 100644 (file)
@@ -1,3 +1,101 @@
+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
index 88a29c597908d2da1c46292dff3821e03ab2e901..0abea03ec82938de6308550d01c264ee4e88fe90 100644 (file)
@@ -28,8 +28,9 @@
  */
 
 [
-    JSBuiltinConstructor,
+    JSBuiltin,
+    Constructor,
     Conditional=STREAMS_API,
 ] interface ByteLengthQueuingStrategy {
-    [JSBuiltin] double size();
+    double size();
 };
index 01eb703b411e2f6b9b0efe2b342065278f8ff27e..a41263f6fc9771806f143ed50ce70834827e0703 100644 (file)
@@ -28,8 +28,9 @@
  */
 
 [
-    JSBuiltinConstructor,
+    JSBuiltin,
+    Constructor,
     Conditional=STREAMS_API,
 ] interface CountQueuingStrategy {
-    [JSBuiltin] double size();
+    double size();
 };
index 049cc9f3b6f4fda628b218600c2638d61ac80038..e7d5f6dfd071f25d87b4f88bc743b6b170959765 100644 (file)
 
 [
     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;
 };
diff --git a/Source/WebCore/Modules/streams/ReadableStreamController.h b/Source/WebCore/Modules/streams/ReadableStreamController.h
deleted file mode 100644 (file)
index 8fc478c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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
index 237b154c9dd634fc213cb3582b69df39f4aec032..95147af6db07112f73b3f76da1dc5fb7a2e382af 100644 (file)
 [
     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;
 };
diff --git a/Source/WebCore/Modules/streams/ReadableStreamReader.h b/Source/WebCore/Modules/streams/ReadableStreamReader.h
deleted file mode 100644 (file)
index 3922c92..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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
index 3fe8bec2cb0859d39043e9c5dbf32323056275a9..3408085a3607aaeedcbb0b009ba12f5c5c2ba6e5 100644 (file)
 [
     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;
 };
index d821a3b4e56098a7fe89c6468fc2d9e14f8e15cb..541282b442512bd1d23a7ee1032b30a05ff8560e 100644 (file)
 
 [
     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;
 };
index 0410938d51569bfe35be32d0407e90b799ad63a2..e2051e68531ccef30e6ac81e2362d0fe43ccf328 100644 (file)
@@ -65,12 +65,12 @@ template<> const ClassInfo JSBuiltinReadableStreamControllerPrivateConstructor::
 
 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)
index 756b59d53100912bb0dc321300e1d4cd851befe8..8861927f5ba0fbfeb938fcdc665cd1992de3d100 100644 (file)
@@ -522,7 +522,7 @@ sub NeedsImplementationClass
 {
     my ($interface) = @_;
 
-    return 0 if ($interface->extendedAttributes->{"JSBuiltinConstructor"});
+    return 0 if ($interface->extendedAttributes->{"JSBuiltin"});
     return 1;
 }
 
@@ -574,11 +574,11 @@ sub ShouldGenerateToJSImplementation
 
 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" : "");
@@ -586,11 +586,11 @@ sub GetAttributeGetterName
 
 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" : "");
@@ -598,9 +598,9 @@ sub GetAttributeSetterName
 
 sub GetFunctionName
 {
-    my ($className, $function) = @_;
+    my ($interface, $className, $function) = @_;
 
-    if ($function->signature->extendedAttributes->{"JSBuiltin"}) {
+    if (IsJSBuiltin($interface, $function)) {
         return GetJSBuiltinFunctionName($className, $function);
     }
 
@@ -830,7 +830,7 @@ sub InstanceNeedsVisitChildren
         || $interface->extendedAttributes->{"EventTarget"}
         || $interface->name eq "EventTarget"
         || $interface->extendedAttributes->{"ReportExtraMemoryCost"}
-        || $interface->extendedAttributes->{"JSBuiltinConstructor"};
+        || IsJSBuiltinConstructor($interface)
 }
 
 sub GetImplClassName
@@ -1295,7 +1295,7 @@ sub GenerateHeader
 
             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;
         }
@@ -1311,10 +1311,10 @@ sub GenerateHeader
 
             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;
@@ -1393,18 +1393,18 @@ sub GenerateAttributesHashTable
 
         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);
         }
 
@@ -1809,7 +1809,7 @@ sub GenerateImplementation
             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) {
@@ -1824,7 +1824,7 @@ sub GenerateImplementation
 
             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;
         }
@@ -1838,14 +1838,14 @@ sub GenerateImplementation
         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;
@@ -1935,13 +1935,13 @@ sub GenerateImplementation
             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);
             }
 
@@ -1959,7 +1959,7 @@ sub GenerateImplementation
             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);
@@ -2031,7 +2031,7 @@ sub GenerateImplementation
         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);
@@ -2107,7 +2107,7 @@ sub GenerateImplementation
                 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");
@@ -2271,14 +2271,14 @@ sub GenerateImplementation
     $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"};
 
@@ -2617,11 +2617,11 @@ sub GenerateImplementation
 
     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"};
 
@@ -2853,7 +2853,7 @@ sub GenerateImplementation
         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) {
@@ -2873,7 +2873,7 @@ sub GenerateImplementation
 
             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) {
@@ -4599,9 +4599,9 @@ sub GeneratePrototypeDeclaration
 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";
 }
 
@@ -4705,7 +4705,7 @@ sub GenerateConstructorDefinition
     my $generatingNamedConstructor = shift;
     my $function = shift;
 
-    return if ($interface->extendedAttributes->{"JSBuiltinConstructor"});
+    return if IsJSBuiltinConstructor($interface);
 
     my $constructorClassName = $generatingNamedConstructor ? "${className}NamedConstructor" : "${className}Constructor";
 
@@ -4955,7 +4955,7 @@ sub GenerateConstructorHelperMethods
         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");
@@ -5009,7 +5009,7 @@ sub IsConstructable
 {
     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
@@ -5028,7 +5028,7 @@ sub ComputeFunctionSpecial
     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 {
@@ -5037,6 +5037,29 @@ sub ComputeFunctionSpecial
     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) = @_;
@@ -5064,17 +5087,17 @@ sub AddJSBuiltinIncludesIfNeeded()
 {
     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);
     }
 }
 
index dbc6b2d1613991c6ef0883efc4c6665886c037db..d074f54c3b5dece01df17b10b131bbe50b6f513e 100644 (file)
@@ -67,6 +67,11 @@ WebKitDOMTestJSBuiltinConstructor* wrapTestJSBuiltinConstructor(WebCore::TestJSB
 
 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);
@@ -77,6 +82,34 @@ static void webkit_dom_test_js_builtin_constructor_finalize(GObject* 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);
@@ -94,6 +127,19 @@ static void webkit_dom_test_js_builtin_constructor_class_init(WebKitDOMTestJSBui
     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)
@@ -102,3 +148,28 @@ static void webkit_dom_test_js_builtin_constructor_init(WebKitDOMTestJSBuiltinCo
     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);
+}
+
index 3a0b3f37e8d2adb7a9ec1b3ddac102de1a5d5afb..1d50c870f1499af5336c8b6d3c8a6183a70b3ed9 100644 (file)
@@ -47,6 +47,36 @@ struct _WebKitDOMTestJSBuiltinConstructorClass {
 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 */
index 2576d84308e679df655043ac1c87205ef330e736..bf7cc3272203190434ece8f5e1a56c7d31c8b5c9 100644 (file)
 #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 {
@@ -61,6 +69,23 @@ private:
 
 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);
@@ -80,6 +105,9 @@ template<> const ClassInfo JSTestJSBuiltinConstructorConstructor::s_info = { "Te
 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) };
@@ -90,7 +118,7 @@ void JSTestJSBuiltinConstructorPrototype::finishCreation(VM& vm)
     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) { }
@@ -111,6 +139,35 @@ void JSTestJSBuiltinConstructor::destroy(JSC::JSCell* cell)
     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);
@@ -119,11 +176,33 @@ EncodedJSValue jsTestJSBuiltinConstructorConstructor(ExecState* state, JSObject*
     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);
index 4202942d2b7926efec6c08cae781de0371b2880d..8c1df5dc4e899fe2621774354a81bef0254c6bac 100644 (file)
@@ -37,6 +37,7 @@ public:
 
     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;
@@ -49,6 +50,16 @@ public:
     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&);
 
index c52dc72d0226fe31d113c4e803eabadc99d2c3df..c94f8981f9058c5018ecdad743b7f1c7ef8d2a48 100644 (file)
 
 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
index 7bb9ab2115ed4d417515100842c77c63cae3f259..e273822f6cbd9e14ca854b4288d7b5b83f04b93d 100644 (file)
     [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)
index fd3bc8576b0200974965e08cfbd7fff3156f7c6b..3ac0cd1a8c5b93f052c51bdd8e0f37396518b613 100644 (file)
@@ -28,6 +28,7 @@
 
 [
     CustomConstructor,
+    JSBuiltIn,
     NoInterfaceObject
 ] interface TestCustomConstructorWithNoInterfaceObject {
 };
index 6a1f1ddfa156b41862de066507889c889bc0ca50..1dd918e5e614786f1827ddd982455fb2429019a6 100644 (file)
  */
 
 [
-    JSBuiltinConstructor
+    JSBuiltin,
+    Constructor
 ] interface TestJSBuiltinConstructor {
-};
 
+    void testFunction();
+    attribute boolean testAttribute;
+
+    [ Custom ] void testCustomFunction();
+    [ CustomGetter ] readonly attribute boolean testAttributeCustom;
+    [ CustomGetter, CustomSetter ] attribute boolean testAttributeRWCustom;
+
+};