Title: [271137] trunk/Source/WebCore
Revision
271137
Author
[email protected]
Date
2021-01-04 12:01:40 -0800 (Mon, 04 Jan 2021)

Log Message

[WebIDL] Remove [LegacyCaller] extended attribute
https://bugs.webkit.org/show_bug.cgi?id=220246

Reviewed by Sam Weinig.

Before this change, [LegacyCaller] implementation was very complex yet versatile, handling
overloads and multiple callers via operation cloning.

This patch removes [LegacyCaller], instead of simplifying it, and leverages [CustomGetCallData]
to implement HTMLAllCollection's [[Call]] method for a few reasons:

1. Legacy callers were removed from the WebIDL spec [1], with `document.all` being the only
   use case; callable objects won't ever be introduced.
2. To closely match the HTML spec [2] by returning early rather than passing nullish AtomString.
3. To make getCallData() override more obvious to a reader unfamiliar with legacy callers.
4. To maximize the amount of code removed from the generator.

No new tests, no behavior change.

[1] https://github.com/heycam/webidl/pull/412
[2] https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#HTMLAllCollection-call

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSHTMLAllCollectionCustom.cpp: Added.
(WebCore::JSC_DEFINE_HOST_FUNCTION):
(WebCore::JSHTMLAllCollection::getCallData):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInterface):
(GenerateGetCallData):
(InstanceOverridesGetCallData):
(AddLegacyCallerOperationIfNeeded): Deleted.
(GeneratePluginCall): Deleted.
(GenerateLegacyCallerDefinitions): Deleted.
(GenerateLegacyCallerDefinition): Deleted.
* bindings/scripts/IDLAttributes.json:
* bindings/scripts/IDLParser.pm:
(cloneArgument): Deleted.
(cloneOperation): Deleted.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObjDOMConstructor::construct):
(WebCore::callJSTestObj1): Deleted.
(WebCore::callJSTestObj2): Deleted.
(WebCore::callJSTestObj3): Deleted.
(WebCore::JSTestObj::getCallData): Deleted.
(WebCore::jsTestObjPrototypeFunction_legacyCallerNamedBody): Deleted.
* bindings/scripts/test/JS/JSTestObj.h:
* bindings/scripts/test/TestObj.idl:
* html/HTMLAllCollection.idl:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271136 => 271137)


--- trunk/Source/WebCore/ChangeLog	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/ChangeLog	2021-01-04 20:01:40 UTC (rev 271137)
@@ -1,3 +1,55 @@
+2021-01-04  Alexey Shvayka  <[email protected]>
+
+        [WebIDL] Remove [LegacyCaller] extended attribute
+        https://bugs.webkit.org/show_bug.cgi?id=220246
+
+        Reviewed by Sam Weinig.
+
+        Before this change, [LegacyCaller] implementation was very complex yet versatile, handling
+        overloads and multiple callers via operation cloning.
+
+        This patch removes [LegacyCaller], instead of simplifying it, and leverages [CustomGetCallData]
+        to implement HTMLAllCollection's [[Call]] method for a few reasons:
+
+        1. Legacy callers were removed from the WebIDL spec [1], with `document.all` being the only
+           use case; callable objects won't ever be introduced.
+        2. To closely match the HTML spec [2] by returning early rather than passing nullish AtomString.
+        3. To make getCallData() override more obvious to a reader unfamiliar with legacy callers.
+        4. To maximize the amount of code removed from the generator.
+
+        No new tests, no behavior change.
+
+        [1] https://github.com/heycam/webidl/pull/412
+        [2] https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#HTMLAllCollection-call
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSHTMLAllCollectionCustom.cpp: Added.
+        (WebCore::JSC_DEFINE_HOST_FUNCTION):
+        (WebCore::JSHTMLAllCollection::getCallData):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateInterface):
+        (GenerateGetCallData):
+        (InstanceOverridesGetCallData):
+        (AddLegacyCallerOperationIfNeeded): Deleted.
+        (GeneratePluginCall): Deleted.
+        (GenerateLegacyCallerDefinitions): Deleted.
+        (GenerateLegacyCallerDefinition): Deleted.
+        * bindings/scripts/IDLAttributes.json:
+        * bindings/scripts/IDLParser.pm:
+        (cloneArgument): Deleted.
+        (cloneOperation): Deleted.
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::JSTestObjDOMConstructor::construct):
+        (WebCore::callJSTestObj1): Deleted.
+        (WebCore::callJSTestObj2): Deleted.
+        (WebCore::callJSTestObj3): Deleted.
+        (WebCore::JSTestObj::getCallData): Deleted.
+        (WebCore::jsTestObjPrototypeFunction_legacyCallerNamedBody): Deleted.
+        * bindings/scripts/test/JS/JSTestObj.h:
+        * bindings/scripts/test/TestObj.idl:
+        * html/HTMLAllCollection.idl:
+
 2020-12-31  Simon Fraser  <[email protected]>
 
         [LFC Display] Hook up very basic repaint in the display tree

Modified: trunk/Source/WebCore/Sources.txt (271136 => 271137)


--- trunk/Source/WebCore/Sources.txt	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/Sources.txt	2021-01-04 20:01:40 UTC (rev 271137)
@@ -553,6 +553,7 @@
 bindings/js/JSExtendableMessageEventCustom.cpp
 bindings/js/JSFetchEventCustom.cpp
 bindings/js/JSFileSystemEntryCustom.cpp
+bindings/js/JSHTMLAllCollectionCustom.cpp
 bindings/js/JSHTMLCanvasElementCustom.cpp
 bindings/js/JSHTMLCollectionCustom.cpp
 bindings/js/JSHTMLDocumentCustom.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (271136 => 271137)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-01-04 20:01:40 UTC (rev 271137)
@@ -11155,6 +11155,7 @@
 		84B62684133138F90095A489 /* FontPlatformData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontPlatformData.cpp; sourceTree = "<group>"; };
 		84B6B975120F13E500B8EFAF /* SVGPathSegListSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegListSource.cpp; sourceTree = "<group>"; };
 		84B6B976120F13E500B8EFAF /* SVGPathSegListSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegListSource.h; sourceTree = "<group>"; };
+		84BBE5482597E7F100AA8F28 /* JSHTMLAllCollectionCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLAllCollectionCustom.cpp; sourceTree = "<group>"; };
 		84C0B67324DBACA20058DF96 /* CustomXPathNSResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomXPathNSResolver.cpp; sourceTree = "<group>"; };
 		84C5B2F81216DC810088B53A /* SVGPathTraversalStateBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathTraversalStateBuilder.cpp; sourceTree = "<group>"; };
 		84C5B2F91216DC810088B53A /* SVGPathTraversalStateBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathTraversalStateBuilder.h; sourceTree = "<group>"; };
@@ -22706,6 +22707,7 @@
 				46B63F6B1C6E8CDF002E914B /* JSEventTargetCustom.h */,
 				4131F3B11F9552810059995A /* JSFetchEventCustom.cpp */,
 				835B680E1F548BDE0071F7F6 /* JSFileSystemEntryCustom.cpp */,
+				84BBE5482597E7F100AA8F28 /* JSHTMLAllCollectionCustom.cpp */,
 				6E576BC324EB509C0094D4AA /* JSHTMLCanvasElementCustom.cpp */,
 				BCCBAD3A0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp */,
 				BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */,

Added: trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp (0 => 271137)


--- trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp	2021-01-04 20:01:40 UTC (rev 271137)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2021 Alexey Shvayka <[email protected]>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSHTMLAllCollection.h"
+
+#include "Element.h"
+#include "HTMLCollection.h"
+#include "JSDOMConvertInterface.h"
+#include "JSDOMConvertNullable.h"
+#include "JSDOMConvertUnion.h"
+
+namespace WebCore {
+using namespace JSC;
+
+static JSC_DECLARE_HOST_FUNCTION(callJSHTMLAllCollection);
+
+// https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#HTMLAllCollection-call
+JSC_DEFINE_HOST_FUNCTION(callJSHTMLAllCollection, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
+{
+    VM& vm = lexicalGlobalObject->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    auto* castedThis = jsCast<JSHTMLAllCollection*>(callFrame->jsCallee());
+    ASSERT(castedThis);
+    auto& impl = castedThis->wrapped();
+    if (callFrame->argument(0).isUndefined())
+        return JSValue::encode(jsNull());
+
+    AtomString nameOrIndex = callFrame->uncheckedArgument(0).toString(lexicalGlobalObject)->toAtomString(lexicalGlobalObject);
+    RETURN_IF_EXCEPTION(scope, { });
+    RELEASE_AND_RETURN(scope, JSValue::encode(toJS<IDLNullable<IDLUnion<IDLInterface<HTMLCollection>, IDLInterface<Element>>>>(*lexicalGlobalObject, *castedThis->globalObject(), impl.namedOrIndexedItemOrItems(WTFMove(nameOrIndex)))));
+}
+
+CallData JSHTMLAllCollection::getCallData(JSCell*)
+{
+    CallData callData;
+    callData.type = CallData::Type::Native;
+    callData.native.function = callJSHTMLAllCollection;
+    return callData;
+}
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (271136 => 271137)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2021-01-04 20:01:40 UTC (rev 271137)
@@ -167,7 +167,6 @@
     AddMapLikeAttributesAndOperationIfNeeded($interface);
     AddSetLikeAttributesAndOperationIfNeeded($interface);
     AddStringifierOperationIfNeeded($interface);
-    AddLegacyCallerOperationIfNeeded($interface);
 
     if ($interface->isCallback) {
         $object->GenerateCallbackInterfaceHeader($interface, $enumerations, $dictionaries);
@@ -487,23 +486,6 @@
     }
 }
 
-sub AddLegacyCallerOperationIfNeeded
-{
-    my $interface = shift;
-
-    foreach my $operation (@{$interface->operations}, @{$interface->anonymousOperations}) {
-        if ($operation->extendedAttributes->{LegacyCaller}) {
-            $interface->{LegacyCallers} = [] if !exists $interface->{LegacyCallers};
-
-            my $clonedOperation = IDLParser::cloneOperation($operation);
-            push(@{$interface->{LegacyCallers}}, $clonedOperation);
-    
-            $clonedOperation->{overloads} = $interface->{LegacyCallers};
-            $clonedOperation->{overloadIndex} = @{$interface->{LegacyCallers}};
-        }
-    }
-}
-
 sub EventHandlerAttributeEventName
 {
     my $attribute = shift;
@@ -5918,17 +5900,6 @@
 
     return if $interface->extendedAttributes->{CustomGetCallData};
 
-    if ($interface->extendedAttributes->{Plugin}) {
-        GeneratePluginCall($outputArray, $interface, $className);
-    } else {
-        GenerateLegacyCallerDefinitions($outputArray, $interface, $className);
-    }
-}
-
-sub GeneratePluginCall
-{
-    my ($outputArray, $interface, $className) = @_;
-
     AddToImplIncludes("JSPluginElementFunctions.h");
 
     push(@$outputArray, "CallData ${className}::getCallData(JSCell* cell)\n");
@@ -5941,74 +5912,6 @@
     push(@$outputArray, "\n");
 }
 
-sub GenerateLegacyCallerDefinitions
-{
-    my ($outputArray, $interface, $className) = @_;
-
-    my @legacyCallers = @{$interface->{LegacyCallers}};
-    if (@legacyCallers > 1) {
-        foreach my $legacyCaller (@legacyCallers) {
-            GenerateLegacyCallerDefinition($outputArray, $interface, $className, $legacyCaller);
-        }
-
-        my $overloadFunctionPrefix = "call${className}";
-
-        push(@$outputArray, "JSC_DEFINE_HOST_FUNCTION(${overloadFunctionPrefix}, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))\n");
-        push(@$outputArray, "{\n");
-        push(@$outputArray, "    VM& vm = lexicalGlobalObject->vm();\n");
-        push(@$outputArray, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
-        push(@$outputArray, "    UNUSED_PARAM(throwScope);\n");
-
-        GenerateOverloadDispatcher($legacyCallers[0], $interface, $overloadFunctionPrefix, "", "lexicalGlobalObject, callFrame");
-
-        push(@$outputArray, "}\n\n");
-    } else {
-        GenerateLegacyCallerDefinition($outputArray, $interface, $className, $legacyCallers[0]);
-    }
-
-    push(@$outputArray, "CallData ${className}::getCallData(JSCell*)\n");
-    push(@$outputArray, "{\n");
-    push(@$outputArray, "    CallData callData;\n");
-    push(@$outputArray, "    callData.type = CallData::Type::Native;\n");
-    push(@$outputArray, "    callData.native.function = call${className};\n");
-    push(@$outputArray, "    return callData;\n");
-    push(@$outputArray, "}\n");
-    push(@$outputArray, "\n");
-}
-
-sub GenerateLegacyCallerDefinition
-{
-    my ($outputArray, $interface, $className, $operation) = @_;
-
-    my $isOverloaded = $operation->{overloads} && @{$operation->{overloads}} > 1;
-    if ($isOverloaded) {
-        push(@$outputArray, "static inline EncodedJSValue call${className}$operation->{overloadIndex}(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame)\n");
-    } else {
-        push(@$outputArray, "static JSC_DECLARE_HOST_FUNCTION(call${className});\n");
-        push(@$outputArray, "JSC_DEFINE_HOST_FUNCTION(call${className}, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))\n");
-    }
-
-    push(@$outputArray, "{\n");
-    push(@$outputArray, "    VM& vm = lexicalGlobalObject->vm();\n");
-    push(@$outputArray, "    auto throwScope = DECLARE_THROW_SCOPE(vm);\n");
-    push(@$outputArray, "    UNUSED_PARAM(throwScope);\n");
-
-    my $indent = "    ";
-    GenerateArgumentsCountCheck($outputArray, $operation, $interface, $indent);
-
-    push(@$outputArray, "    auto* castedThis = jsCast<${className}*>(callFrame->jsCallee());\n");
-    push(@$outputArray, "    ASSERT(castedThis);\n");
-    push(@$outputArray, "    auto& impl = castedThis->wrapped();\n");
-
-    my $functionImplementationName = $operation->extendedAttributes->{ImplementedAs} || $codeGenerator->WK_lcfirst($operation->name) || "legacyCallerOperationFromBindings";
-    my $functionString = GenerateParametersCheck($outputArray, $operation, $interface, $functionImplementationName, $indent);
-
-    my $hasThrowScope = 1;
-    GenerateImplementationFunctionCall($outputArray, $operation, $interface, $functionString, $indent, $hasThrowScope);
-
-    push(@$outputArray, "}\n\n");
-}
-
 sub GenerateCallWithUsingReferences
 {
     my ($callWith, $outputArray, $returnValue, $thisReference, $indent) = @_;
@@ -8016,7 +7919,7 @@
 sub InstanceOverridesGetCallData
 {
     my $interface = shift;
-    return $interface->{LegacyCallers} || $interface->extendedAttributes->{CustomGetCallData} || $interface->extendedAttributes->{Plugin};
+    return $interface->extendedAttributes->{CustomGetCallData} || $interface->extendedAttributes->{Plugin};
 }
 
 sub HeaderNeedsPrototypeDeclaration

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.json (271136 => 271137)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.json	2021-01-04 20:01:40 UTC (rev 271137)
@@ -295,9 +295,6 @@
             "contextsAllowed": ["interface"],
             "values": ["*"]
         },
-        "LegacyCaller": {
-            "contextsAllowed": ["operation"]
-        },
         "LegacyFactoryFunction": {
             "contextsAllowed": ["interface"],
             "values": ["*"],

Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (271136 => 271137)


--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2021-01-04 20:01:40 UTC (rev 271137)
@@ -549,43 +549,6 @@
     return $clonedType;
 }
 
-sub cloneArgument
-{
-    my $argument = shift;
-
-    my $clonedArgument = IDLArgument->new();
-    $clonedArgument->name($argument->name);
-    $clonedArgument->type(cloneType($argument->type));
-    $clonedArgument->isVariadic($argument->isVariadic);
-    $clonedArgument->isOptional($argument->isOptional);
-    $clonedArgument->default($argument->default);
-    copyExtendedAttributes($clonedArgument->extendedAttributes, $argument->extendedAttributes);
-
-    return $clonedArgument;
-}
-
-sub cloneOperation
-{
-    my $operation = shift;
-
-    my $clonedOperation = IDLOperation->new();
-    $clonedOperation->name($operation->name);
-    $clonedOperation->type(cloneType($operation->type));
-    
-    foreach my $argument (@{$operation->arguments}) {
-        push(@{$clonedOperation->arguments}, cloneArgument($argument));
-    }
-
-    $clonedOperation->isConstructor($operation->isConstructor);
-    $clonedOperation->isStatic($operation->isStatic);
-    $clonedOperation->isStringifier($operation->isStringifier);
-    $clonedOperation->specials($operation->specials);
-
-    copyExtendedAttributes($clonedOperation->extendedAttributes, $operation->extendedAttributes);
-
-    return $clonedOperation;
-}
-
 sub makeSimpleType
 {
     my $typeName = shift;

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2021-01-04 20:01:40 UTC (rev 271137)
@@ -1591,7 +1591,6 @@
 static JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_attachShadowRoot);
 static JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_operationWithExternalDictionaryParameter);
 static JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_bufferSourceParameter);
-static JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_legacyCallerNamed);
 static JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_testReturnValueOptimization);
 static JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_testReturnValueOptimizationWithException);
 static JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_conditionallyExposedToWindowFunction);
@@ -2323,7 +2322,6 @@
     { "attachShadowRoot", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_attachShadowRoot), (intptr_t) (1) } },
     { "operationWithExternalDictionaryParameter", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_operationWithExternalDictionaryParameter), (intptr_t) (1) } },
     { "bufferSourceParameter", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_bufferSourceParameter), (intptr_t) (1) } },
-    { "legacyCallerNamed", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_legacyCallerNamed), (intptr_t) (1) } },
     { "testReturnValueOptimization", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_testReturnValueOptimization), (intptr_t) (2) } },
     { "testReturnValueOptimizationWithException", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_testReturnValueOptimizationWithException), (intptr_t) (2) } },
     { "conditionallyExposedToWindowFunction", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_conditionallyExposedToWindowFunction), (intptr_t) (0) } },
@@ -2540,75 +2538,6 @@
     JSObject::getOwnPropertyNames(object, lexicalGlobalObject, propertyNames, mode);
 }
 
-static inline EncodedJSValue callJSTestObj1(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame)
-{
-    VM& vm = lexicalGlobalObject->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    UNUSED_PARAM(throwScope);
-    auto* castedThis = jsCast<JSTestObj*>(callFrame->jsCallee());
-    ASSERT(castedThis);
-    auto& impl = castedThis->wrapped();
-    EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
-    auto param = convert<IDLLong>(*lexicalGlobalObject, argument0.value());
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    throwScope.release();
-    impl.legacyCallerNamed(WTFMove(param));
-    return JSValue::encode(jsUndefined());
-}
-
-static inline EncodedJSValue callJSTestObj2(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame)
-{
-    VM& vm = lexicalGlobalObject->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    UNUSED_PARAM(throwScope);
-    auto* castedThis = jsCast<JSTestObj*>(callFrame->jsCallee());
-    ASSERT(castedThis);
-    auto& impl = castedThis->wrapped();
-    EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
-    auto param = convert<IDLDOMString>(*lexicalGlobalObject, argument0.value());
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    RELEASE_AND_RETURN(throwScope, JSValue::encode(toJS<IDLLong>(impl.legacyCallerOperationFromBindings(WTFMove(param)))));
-}
-
-static inline EncodedJSValue callJSTestObj3(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame)
-{
-    VM& vm = lexicalGlobalObject->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    UNUSED_PARAM(throwScope);
-    auto* castedThis = jsCast<JSTestObj*>(callFrame->jsCallee());
-    ASSERT(castedThis);
-    auto& impl = castedThis->wrapped();
-    throwScope.release();
-    impl.legacyCallerOperationFromBindings();
-    return JSValue::encode(jsUndefined());
-}
-
-JSC_DEFINE_HOST_FUNCTION(callJSTestObj, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
-{
-    VM& vm = lexicalGlobalObject->vm();
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    UNUSED_PARAM(throwScope);
-    size_t argsCount = std::min<size_t>(1, callFrame->argumentCount());
-    if (argsCount == 0) {
-        RELEASE_AND_RETURN(throwScope, (callJSTestObj3(lexicalGlobalObject, callFrame)));
-    }
-    if (argsCount == 1) {
-        JSValue distinguishingArg = callFrame->uncheckedArgument(0);
-        if (distinguishingArg.isNumber())
-            RELEASE_AND_RETURN(throwScope, (callJSTestObj1(lexicalGlobalObject, callFrame)));
-        RELEASE_AND_RETURN(throwScope, (callJSTestObj2(lexicalGlobalObject, callFrame)));
-    }
-    return throwVMTypeError(lexicalGlobalObject, throwScope);
-}
-
-CallData JSTestObj::getCallData(JSCell*)
-{
-    CallData callData;
-    callData.type = CallData::Type::Native;
-    callData.native.function = callJSTestObj;
-    return callData;
-}
-
 template<> inline JSTestObj* IDLAttribute<JSTestObj>::cast(JSGlobalObject& lexicalGlobalObject, EncodedJSValue thisValue)
 {
     return jsDynamicCast<JSTestObj*>(JSC::getVM(&lexicalGlobalObject), JSValue::decode(thisValue));
@@ -9291,28 +9220,6 @@
     return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunction_bufferSourceParameterBody>(*lexicalGlobalObject, *callFrame, "bufferSourceParameter");
 }
 
-static inline JSC::EncodedJSValue jsTestObjPrototypeFunction_legacyCallerNamedBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
-{
-    auto& vm = JSC::getVM(lexicalGlobalObject);
-    auto throwScope = DECLARE_THROW_SCOPE(vm);
-    UNUSED_PARAM(throwScope);
-    UNUSED_PARAM(callFrame);
-    auto& impl = castedThis->wrapped();
-    if (UNLIKELY(callFrame->argumentCount() < 1))
-        return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
-    EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
-    auto param = convert<IDLLong>(*lexicalGlobalObject, argument0.value());
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    throwScope.release();
-    impl.legacyCallerNamed(WTFMove(param));
-    return JSValue::encode(jsUndefined());
-}
-
-JSC_DEFINE_HOST_FUNCTION(jsTestObjPrototypeFunction_legacyCallerNamed, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
-{
-    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunction_legacyCallerNamedBody>(*lexicalGlobalObject, *callFrame, "legacyCallerNamed");
-}
-
 static inline JSC::EncodedJSValue jsTestObjPrototypeFunction_testReturnValueOptimizationBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
 {
     auto& vm = JSC::getVM(lexicalGlobalObject);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (271136 => 271137)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2021-01-04 20:01:40 UTC (rev 271137)
@@ -24,7 +24,6 @@
 #include "JSDOMConvertEnumeration.h"
 #include "JSDOMWrapper.h"
 #include "TestObj.h"
-#include <_javascript_Core/CallData.h>
 #include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
@@ -45,8 +44,6 @@
     static bool getOwnPropertySlot(JSC::JSObject*, JSC::JSGlobalObject*, JSC::PropertyName, JSC::PropertySlot&);
     static bool getOwnPropertySlotByIndex(JSC::JSObject*, JSC::JSGlobalObject*, unsigned propertyName, JSC::PropertySlot&);
     static void getOwnPropertyNames(JSC::JSObject*, JSC::JSGlobalObject*, JSC::PropertyNameArray&, JSC::EnumerationMode = JSC::EnumerationMode());
-    static JSC::CallData getCallData(JSC::JSCell*);
-
     static void destroy(JSC::JSCell*);
 
     DECLARE_INFO;
@@ -85,7 +82,7 @@
     static JSC::JSValue testStaticCustomPromiseFunction(JSC::JSGlobalObject&, JSC::CallFrame&, Ref<DeferredPromise>&&);
     JSC::JSValue testCustomReturnsOwnPromiseFunction(JSC::JSGlobalObject&, JSC::CallFrame&);
 public:
-    static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::HasStaticPropertyTable | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesAnyFormOfGetPropertyNames | JSC::OverridesGetCallData | JSC::OverridesGetOwnPropertySlot;
+    static constexpr unsigned StructureFlags = Base::StructureFlags | JSC::HasStaticPropertyTable | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesAnyFormOfGetPropertyNames | JSC::OverridesGetOwnPropertySlot;
 protected:
     JSTestObj(JSC::Structure*, JSDOMGlobalObject&, Ref<TestObj>&&);
 

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (271136 => 271137)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2021-01-04 20:01:40 UTC (rev 271137)
@@ -442,10 +442,6 @@
 
     undefined bufferSourceParameter(BufferSource data);
 
-    [LegacyCaller] undefined legacyCallerNamed(long param);
-    [LegacyCaller] long (DOMString param);
-    [LegacyCaller] undefined ();
-
     Node testReturnValueOptimization([ReturnValue] Node a, Node b);
     [MayThrowException] Node testReturnValueOptimizationWithException([ReturnValue] Node a, Node b);
 

Modified: trunk/Source/WebCore/html/HTMLAllCollection.idl (271136 => 271137)


--- trunk/Source/WebCore/html/HTMLAllCollection.idl	2021-01-04 19:12:12 UTC (rev 271136)
+++ trunk/Source/WebCore/html/HTMLAllCollection.idl	2021-01-04 20:01:40 UTC (rev 271137)
@@ -26,6 +26,7 @@
 [
     LegacyUnenumerableNamedProperties,
     MasqueradesAsUndefined,
+    CustomGetCallData,
     GenerateIsReachable=ImplOwnerNodeRoot,
     Exposed=Window
 ] interface HTMLAllCollection {
@@ -33,5 +34,5 @@
 
     getter Element? (unsigned long index);
     [ImplementedAs=namedItemOrItems] getter (HTMLCollection or Element)? namedItem([RequiresExistingAtomString] DOMString name);
-    [ImplementedAs=namedOrIndexedItemOrItems, LegacyCaller] (HTMLCollection or Element)? item(optional [AtomString] DOMString nameOrIndex);
+    [ImplementedAs=namedOrIndexedItemOrItems] (HTMLCollection or Element)? item(optional [AtomString] DOMString nameOrIndex);
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to