Changeset 181001 in webkit


Ignore:
Timestamp:
Mar 4, 2015 9:30:32 AM (9 years ago)
Author:
Darin Adler
Message:

Make JavaScript binding get and set legacy event listener attributes directly
https://bugs.webkit.org/show_bug.cgi?id=142282

Reviewed by Sam Weinig.

Test: fast/dom/legacy-event-handler-attributes.html

This patch changes the JavaScript getters and setters for these attributes
to work directly without requiring any functions in the C++ DOM implementation.
A subsequent patch will remove the now-unused C++ DOM implementation.

  • bindings/js/JSEventListener.cpp:

(WebCore::legacyEventListenerAttribute): Added.
(WebCore::createEventListenerForLegacyAttribute): Added.
(WebCore::setLegacyEventListenerAttribute): Added.
(WebCore::legacyWindowEventListenerAttribute): Added.
(WebCore::setLegacyWindowEventListenerAttribute): Added.

  • bindings/js/JSEventListener.h:

(WebCore::createJSEventListenerForAttribute): Deleted.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateAttributeEventListenerCall): Deleted.
(LegacyEventListenerAttributeEventName): Added.
(LegacyEventListenerAttributePrefix): Added.
(GenerateImplementation): Use "auto" in lots of places to simplify the code
generation. Replaced the old inlined code to deal with legacy event listener
attributes with code that simply calls the new functions from JSEventLister.h.
(GenerateCallWith): Use "auto".
(GenerateConstructorDefinition): Ditto.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r181000 r181001  
     12015-03-04  Darin Adler  <darin@apple.com>
     2
     3        Make JavaScript binding get and set legacy event listener attributes directly
     4        https://bugs.webkit.org/show_bug.cgi?id=142282
     5
     6        Reviewed by Sam Weinig.
     7
     8        Test: fast/dom/legacy-event-handler-attributes.html
     9
     10        This patch changes the JavaScript getters and setters for these attributes
     11        to work directly without requiring any functions in the C++ DOM implementation.
     12        A subsequent patch will remove the now-unused C++ DOM implementation.
     13
     14        * bindings/js/JSEventListener.cpp:
     15        (WebCore::legacyEventListenerAttribute): Added.
     16        (WebCore::createEventListenerForLegacyAttribute): Added.
     17        (WebCore::setLegacyEventListenerAttribute): Added.
     18        (WebCore::legacyWindowEventListenerAttribute): Added.
     19        (WebCore::setLegacyWindowEventListenerAttribute): Added.
     20
     21        * bindings/js/JSEventListener.h:
     22        (WebCore::createJSEventListenerForAttribute): Deleted.
     23
     24        * bindings/scripts/CodeGeneratorJS.pm:
     25        (GenerateAttributeEventListenerCall): Deleted.
     26        (LegacyEventListenerAttributeEventName): Added.
     27        (LegacyEventListenerAttributePrefix): Added.
     28        (GenerateImplementation): Use "auto" in lots of places to simplify the code
     29        generation. Replaced the old inlined code to deal with legacy event listener
     30        attributes with code that simply calls the new functions from JSEventLister.h.
     31        (GenerateCallWith): Use "auto".
     32        (GenerateConstructorDefinition): Ditto.
     33
    1342015-03-03  Sam Weinig  <sam@webkit.org>
    235
  • trunk/Source/WebCore/bindings/js/JSEventListener.cpp

    r179810 r181001  
    2424#include "Event.h"
    2525#include "Frame.h"
     26#include "HTMLElement.h"
    2627#include "JSEvent.h"
    2728#include "JSEventTarget.h"
     
    171172}
    172173
     174static inline JSC::JSValue eventHandlerAttribute(EventListener* abstractListener, ScriptExecutionContext& context)
     175{
     176    if (!abstractListener)
     177        return jsNull();
     178
     179    auto* listener = JSEventListener::cast(abstractListener);
     180    if (!listener)
     181        return jsNull();
     182
     183    auto* function = listener->jsFunction(&context);
     184    if (!function)
     185        return jsNull();
     186
     187    return function;
     188}
     189
     190static inline RefPtr<JSEventListener> createEventListenerForEventHandlerAttribute(JSC::ExecState& state, JSC::JSValue listener, JSC::JSObject& wrapper)
     191{
     192    if (!listener.isObject())
     193        return nullptr;
     194    return JSEventListener::create(asObject(listener), &wrapper, true, currentWorld(&state));
     195}
     196
     197JSC::JSValue eventHandlerAttribute(EventTarget& target, const AtomicString& eventType)
     198{
     199    return eventHandlerAttribute(target.getAttributeEventListener(eventType), *target.scriptExecutionContext());
     200}
     201
     202void setEventHandlerAttribute(JSC::ExecState& state, JSC::JSObject& wrapper, EventTarget& target, const AtomicString& eventType, JSC::JSValue value)
     203{
     204    target.setAttributeEventListener(eventType, createEventListenerForEventHandlerAttribute(state, value, wrapper));
     205}
     206
     207JSC::JSValue windowForwardedEventHandlerAttribute(HTMLElement& element, const AtomicString& eventType)
     208{
     209    auto& document = element.document();
     210    return eventHandlerAttribute(document.getWindowAttributeEventListener(eventType), document);
     211}
     212
     213void setWindowForwardedEventHandlerAttribute(JSC::ExecState& state, JSC::JSObject& wrapper, HTMLElement& element, const AtomicString& eventType, JSC::JSValue value)
     214{
     215    ASSERT(wrapper.globalObject());
     216    element.document().setWindowAttributeEventListener(eventType, createEventListenerForEventHandlerAttribute(state, value, *wrapper.globalObject()));
     217}
     218
    173219} // namespace WebCore
  • trunk/Source/WebCore/bindings/js/JSEventListener.h

    r179812 r181001  
    3030namespace WebCore {
    3131
     32    class EventTarget;
     33    class HTMLElement;
    3234    class JSDOMGlobalObject;
    3335
     
    7678    };
    7779
    78     // For "onXXX" event attributes.
    79     RefPtr<JSEventListener> createJSEventListenerForAttribute(JSC::ExecState&, JSC::JSValue listener, JSC::JSObject& wrapper);
     80    // For "onxxx" attributes that automatically set up JavaScript event listeners.
     81    JSC::JSValue eventHandlerAttribute(EventTarget&, const AtomicString& eventType);
     82    void setEventHandlerAttribute(JSC::ExecState&, JSC::JSObject&, EventTarget&, const AtomicString& eventType, JSC::JSValue);
     83
     84    // Like the functions above, but for attributes that forward event handlers to the window object rather than setting them on the target.
     85    JSC::JSValue windowForwardedEventHandlerAttribute(HTMLElement&, const AtomicString& eventType);
     86    void setWindowForwardedEventHandlerAttribute(JSC::ExecState&, JSC::JSObject&, HTMLElement&, const AtomicString& eventType, JSC::JSValue);
    8087
    8188    Ref<JSEventListener> createJSEventListenerForAdd(JSC::ExecState&, JSC::JSObject& listener, JSC::JSObject& wrapper);
     
    113120    }
    114121
    115     inline RefPtr<JSEventListener> createJSEventListenerForAttribute(JSC::ExecState& state, JSC::JSValue listener, JSC::JSObject& wrapper)
    116     {
    117         if (!listener.isObject())
    118             return nullptr;
    119         return JSEventListener::create(asObject(listener), &wrapper, true, currentWorld(&state));
    120     }
    121 
    122122    inline Ref<JSEventListener> createJSEventListenerForRemove(JSC::ExecState& state, JSC::JSObject& listener, JSC::JSObject& wrapper)
    123123    {
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r180772 r181001  
    141141}
    142142
    143 sub GenerateAttributeEventListenerCall
    144 {
    145     my $implSetterFunctionName = shift;
    146     my $windowEventListener = shift;
    147 
    148     my $wrapperObject = $windowEventListener ? "globalObject" : "castedThis";
    149     my @GenerateEventListenerImpl = ();
    150 
    151     push(@GenerateEventListenerImpl, "    impl.set$implSetterFunctionName(createJSEventListenerForAttribute(*exec, value, *$wrapperObject));\n");
    152     return @GenerateEventListenerImpl;
     143sub EventHandlerAttributeEventName
     144{
     145    my $attribute = shift;
     146
     147    # Remove the "on" prefix.
     148    my $eventType = substr($attribute->signature->name, 2);
     149
     150    # FIXME: Consider adding a property in the IDL file instead of hard coding these four event names.
     151    # Note: This same hard coded list of property names exists in HTMLElement.cpp.
     152    $eventType = "webkitAnimationEnd" if $eventType eq "webkitanimationend";
     153    $eventType = "webkitAnimationIteration" if $eventType eq "webkitanimationiteration";
     154    $eventType = "webkitAnimationStart" if $eventType eq "webkitanimationstart";
     155    $eventType = "webkitTransitionEnd" if $eventType eq "webkittransitionend";
     156
     157    return "eventNames().${eventType}Event";
    153158}
    154159
     
    19701975            push(@implContent, "    VM& vm = exec->vm();\n");
    19711976            push(@implContent, "    UNUSED_PARAM(vm);\n");
    1972             push(@implContent, "    ${className}Prototype* thisObject = jsCast<${className}Prototype*>(object);\n");
     1977            push(@implContent, "    auto* thisObject = jsCast<${className}Prototype*>(object);\n");
    19731978
    19741979            if ($numConstants eq 0 && $numFunctions eq 0 && $numPrototypeAttributes eq 0) {
     
    20132018        push(@implContent, "void ${className}Prototype::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)\n");
    20142019        push(@implContent, "{\n");
    2015         push(@implContent, "    ${className}Prototype* thisObject = jsCast<${className}Prototype*>(cell);\n");
     2020        push(@implContent, "    auto* thisObject = jsCast<${className}Prototype*>(cell);\n");
    20162021        push(@implContent, "    if (thisObject->putDelegate(exec, propertyName, value, slot))\n");
    20172022        push(@implContent, "        return;\n");
     
    21072112            push(@implContent, "bool ${className}::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)\n");
    21082113            push(@implContent, "{\n");
    2109             push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(object);\n");
     2114            push(@implContent, "    auto* thisObject = jsCast<${className}*>(object);\n");
    21102115            push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    21112116            push(@implContent, GenerateGetOwnPropertySlotBody($interface, $interfaceName, $className, $numInstanceAttributes > 0, 0));
     
    21182123            push(@implContent, "bool ${className}::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned index, PropertySlot& slot)\n");
    21192124            push(@implContent, "{\n");
    2120             push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(object);\n");
     2125            push(@implContent, "    auto* thisObject = jsCast<${className}*>(object);\n");
    21212126            push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    21222127
     
    21912196            if (!$attribute->isStatic || $attribute->signature->type =~ /Constructor$/) {
    21922197                if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) {
    2193                     push(@implContent, "    ${className}* castedThis = to${className}(JSValue::decode(thisValue));\n");
     2198                    push(@implContent, "    auto* castedThis = to${className}(JSValue::decode(thisValue));\n");
    21942199                } elsif (AttributeShouldBeOnInstance($interface, $attribute)) {
    2195                     push(@implContent, "    ${className}* castedThis = jsCast<JS${interfaceName}*>(slotBase);\n");
     2200                    push(@implContent, "    auto* castedThis = jsCast<JS${interfaceName}*>(slotBase);\n");
    21962201                    if (InterfaceRequiresAttributesOnInstanceForCompatibility($interface)) {
    21972202                        push(@implContent, "    ${className}* castedThisObject = " . GetCastingHelperForThisObject($interface) . "(JSValue::decode(thisValue));\n");
     
    22842289            } elsif ($attribute->signature->extendedAttributes->{"CheckSecurityForNode"}) {
    22852290                $implIncludes{"JSDOMBinding.h"} = 1;
    2286                 push(@implContent, "    $implType& impl = castedThis->impl();\n");
     2291                push(@implContent, "    auto& impl = castedThis->impl();\n");
    22872292                push(@implContent, "    return JSValue::encode(shouldAllowAccessToNode(exec, impl." . $attribute->signature->name . "()) ? " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName()", "castedThis") . " : jsNull());\n");
    22882293            } elsif ($type eq "EventListener") {
    2289                 $implIncludes{"EventListener.h"} = 1;
     2294                my $getter = $attribute->signature->extendedAttributes->{"JSWindowEventListener"} ? "windowForwardedEventHandlerAttribute" : "eventHandlerAttribute";
     2295                my $eventName = EventHandlerAttributeEventName($attribute);
    22902296                push(@implContent, "    UNUSED_PARAM(exec);\n");
    2291                 push(@implContent, "    $implType& impl = castedThis->impl();\n");
    2292                 push(@implContent, "    if (EventListener* listener = impl.$implGetterFunctionName()) {\n");
    2293                 push(@implContent, "        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {\n");
    2294                 if ($interfaceName eq "Document" || $codeGenerator->InheritsInterface($interface, "WorkerGlobalScope")) {
    2295                     push(@implContent, "            if (JSObject* jsFunction = jsListener->jsFunction(&impl))\n");
    2296                 } else {
    2297                     push(@implContent, "            if (JSObject* jsFunction = jsListener->jsFunction(impl.scriptExecutionContext()))\n");
    2298                 }
    2299                 push(@implContent, "                return JSValue::encode(jsFunction);\n");
    2300                 push(@implContent, "        }\n");
    2301                 push(@implContent, "    }\n");
    2302                 push(@implContent, "    return JSValue::encode(jsNull());\n");
     2297                push(@implContent, "    return JSValue::encode($getter(castedThis->impl(), $eventName));\n");
    23032298            } elsif ($attribute->signature->type =~ /Constructor$/) {
    23042299                my $constructorType = $attribute->signature->type;
     
    23532348                    unshift(@arguments, @callWithArgs);
    23542349                    my $jsType = NativeToJSValue($attribute->signature, 0, $interfaceName, "${functionName}(" . join(", ", @arguments) . ")", "castedThis");
    2355                     push(@implContent, "    $implType& impl = castedThis->impl();\n") if !$attribute->isStatic;
     2350                    push(@implContent, "    auto& impl = castedThis->impl();\n") if !$attribute->isStatic;
    23562351                    if ($codeGenerator->IsSVGAnimatedType($type)) {
    23572352                        push(@implContent, "    RefPtr<$type> obj = $jsType;\n");
     
    23822377                    push(@implContent, "    JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "castedThis") . ";\n");
    23832378                } else {
    2384                     push(@implContent, "    $implType& impl = castedThis->impl();\n");
     2379                    push(@implContent, "    auto& impl = castedThis->impl();\n");
    23852380                    push(@implContent, "    JSValue result = " . NativeToJSValue($attribute->signature, 0, $interfaceName, "impl.$implGetterFunctionName(" . join(", ", @arguments) . ")", "castedThis") . ";\n");
    23862381                }
     
    24732468            push(@implContent, "void ${className}::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)\n");
    24742469            push(@implContent, "{\n");
    2475             push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(cell);\n");
     2470            push(@implContent, "    auto* thisObject = jsCast<${className}*>(cell);\n");
    24762471            push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    24772472            if ($interface->extendedAttributes->{"CustomIndexedSetter"}) {
     
    24932488                push(@implContent, "void ${className}::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSValue value, bool shouldThrow)\n");
    24942489                push(@implContent, "{\n");
    2495                 push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(cell);\n");
     2490                push(@implContent, "    auto* thisObject = jsCast<${className}*>(cell);\n");
    24962491                push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    24972492
     
    25492544                    } elsif (AttributeShouldBeOnInstance($interface, $attribute)) {
    25502545                        push(@implContent, "    UNUSED_PARAM(thisValue);\n");
    2551                         push(@implContent, "    ${className}* castedThis = jsCast<JS${interfaceName}*>(baseObject);\n");
     2546                        push(@implContent, "    auto* castedThis = jsCast<JS${interfaceName}*>(baseObject);\n");
    25522547                        if (InterfaceRequiresAttributesOnInstanceForCompatibility($interface)) {
    25532548                            push(@implContent, "    ${className}* castedThisObject = " . GetCastingHelperForThisObject($interface) . "(JSValue::decode(thisValue));\n");
     
    25812576                    push(@implContent, "    castedThis->set$implSetterFunctionName(exec, value);\n");
    25822577                } elsif ($type eq "EventListener") {
    2583                     $implIncludes{"JSEventListener.h"} = 1;
    2584                     push(@implContent, "    UNUSED_PARAM(exec);\n");
    2585                     my $windowEventListener = $attribute->signature->extendedAttributes->{"JSWindowEventListener"};
    2586                     if ($windowEventListener) {
    2587                         push(@implContent, "    JSDOMGlobalObject* globalObject = castedThis->globalObject();\n");
    2588                     }
    2589                     push(@implContent, "    $implType& impl = castedThis->impl();\n");
     2578                    my $eventName = EventHandlerAttributeEventName($attribute);
     2579                    # FIXME: Find a way to do this special case without hardcoding the class and attribute names here.
    25902580                    if ((($interfaceName eq "DOMWindow") or ($interfaceName eq "WorkerGlobalScope")) and $name eq "onerror") {
    25912581                        $implIncludes{"JSErrorHandler.h"} = 1;
    2592                         push(@implContent, "    impl.set$implSetterFunctionName(createJSErrorHandler(exec, value, castedThis));\n");
     2582                        push(@implContent, "    castedThis->impl().setAttributeEventListener($eventName, createJSErrorHandler(exec, value, castedThis));\n");
    25932583                    } else {
    2594                         push(@implContent, GenerateAttributeEventListenerCall($implSetterFunctionName, $windowEventListener));
     2584                        $implIncludes{"JSEventListener.h"} = 1;
     2585                        my $setter = $attribute->signature->extendedAttributes->{"JSWindowEventListener"} ? "setWindowForwardedEventHandlerAttribute" : "setEventHandlerAttribute";
     2586                        push(@implContent, "    $setter(*exec, *castedThis, castedThis->impl(), $eventName, value);\n");
    25952587                    }
    25962588                } elsif ($attribute->signature->type =~ /Constructor$/) {
     
    26032595                        AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{"Conditional"});
    26042596                    }
    2605                     push(@implContent, "    // Shadowing a built-in constructor\n");
     2597                    push(@implContent, "    // Shadowing a built-in constructor.\n");
    26062598                    push(@implContent, "    castedThis->putDirect(exec->vm(), Identifier(exec, \"$name\"), value);\n");
    26072599                } elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) {
    2608                     push(@implContent, "    // Shadowing a built-in object\n");
     2600                    push(@implContent, "    // Shadowing a built-in object.\n");
    26092601                    push(@implContent, "    castedThis->putDirect(exec->vm(), Identifier(exec, \"$name\"), value);\n");
    26102602                } else {
    26112603                    if (!$attribute->isStatic) {
    2612                         push(@implContent, "    $implType& impl = castedThis->impl();\n");
     2604                        push(@implContent, "    auto& impl = castedThis->impl();\n");
    26132605                    }
    26142606                    push(@implContent, "    ExceptionCode ec = 0;\n") if $setterRaisesException;
     
    27132705        push(@implContent, "void ${className}::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)\n");
    27142706        push(@implContent, "{\n");
    2715         push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(object);\n");
     2707        push(@implContent, "    auto* thisObject = jsCast<${className}*>(object);\n");
    27162708        push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    27172709        push(@implContent, "    for (unsigned i = 0, count = thisObject->impl().length(); i < count; ++i)\n");
     
    28202812                    push(@implContent, "    return JSValue::encode(castedThis->" . $functionImplementationName . "(exec));\n");
    28212813                } else {
    2822                     push(@implContent, "    $implType& impl = castedThis->impl();\n");
     2814                    push(@implContent, "    auto& impl = castedThis->impl();\n");
    28232815                    if ($svgPropertyType) {
    28242816                        push(@implContent, "    if (impl.isReadOnly()) {\n");
     
    28702862        push(@implContent, "void ${className}::visitChildren(JSCell* cell, SlotVisitor& visitor)\n");
    28712863        push(@implContent, "{\n");
    2872         push(@implContent, "    ${className}* thisObject = jsCast<${className}*>(cell);\n");
     2864        push(@implContent, "    auto* thisObject = jsCast<${className}*>(cell);\n");
    28732865        push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
    28742866        push(@implContent, "    Base::visitChildren(thisObject, visitor);\n");
     
    29142906            push(@implContent, "EncodedJSValue ${className}::nameGetter(ExecState* exec, JSObject* slotBase, EncodedJSValue, PropertyName propertyName)\n");
    29152907            push(@implContent, "{\n");
    2916             push(@implContent, "    ${className}* thisObj = jsCast<$className*>(slotBase);\n");
    2917             push(@implContent, "    return JSValue::encode(toJS(exec, thisObj->globalObject(), thisObj->impl().namedItem(propertyNameToAtomicString(propertyName))));\n");
     2908            push(@implContent, "    auto* thisObject = jsCast<$className*>(slotBase);\n");
     2909            push(@implContent, "    return JSValue::encode(toJS(exec, thisObject->globalObject(), thisObject->impl().namedItem(propertyNameToAtomicString(propertyName))));\n");
    29182910            push(@implContent, "}\n\n");
    29192911        }
     
    29452937        my $emittedJSCast = 0;
    29462938        if ($codeGenerator->InheritsExtendedAttribute($interface, "ActiveDOMObject")) {
    2947             push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     2939            push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
    29482940            $emittedJSCast = 1;
    29492941            push(@implContent, "    if (js${interfaceName}->impl().hasPendingActivity())\n");
     
    29522944        if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) {
    29532945            if (!$emittedJSCast) {
    2954                 push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     2946                push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
    29552947                $emittedJSCast = 1;
    29562948            }
     
    29602952        if ($codeGenerator->InheritsInterface($interface, "Node")) {
    29612953            if (!$emittedJSCast) {
    2962                 push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     2954                push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
    29632955                $emittedJSCast = 1;
    29642956            }
     
    29682960        if (GetGenerateIsReachable($interface)) {
    29692961            if (!$emittedJSCast) {
    2970                 push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     2962                push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
    29712963                $emittedJSCast = 1;
    29722964            }
     
    30253017        push(@implContent, "void JS${interfaceName}Owner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)\n");
    30263018        push(@implContent, "{\n");
    3027         push(@implContent, "    JS${interfaceName}* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
    3028         push(@implContent, "    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);\n");
     3019        push(@implContent, "    auto* js${interfaceName} = jsCast<JS${interfaceName}*>(handle.slot()->asCell());\n");
     3020        push(@implContent, "    auto& world = *static_cast<DOMWrapperWorld*>(context);\n");
    30293021        push(@implContent, "    uncacheWrapper(world, &js${interfaceName}->impl(), js${interfaceName});\n");
    30303022        push(@implContent, "    js${interfaceName}->releaseImpl();\n");
     
    31333125    }
    31343126    if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptExecutionContext")) {
    3135         push(@$outputArray, "    ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n");
     3127        push(@$outputArray, "    auto* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n");
    31363128        push(@$outputArray, "    if (!scriptContext)\n");
    31373129        push(@$outputArray, "        return" . ($returnValue ? " " . $returnValue : "") . ";\n");
     
    45104502EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(ExecState* exec)
    45114503{
    4512     ${constructorClassName}* jsConstructor = jsCast<${constructorClassName}*>(exec->callee());
     4504    auto* jsConstructor = jsCast<${constructorClassName}*>(exec->callee());
    45134505
    45144506    ScriptExecutionContext* executionContext = jsConstructor->scriptExecutionContext();
     
    45774569            push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}${overloadedIndexString}(ExecState* exec)\n");
    45784570            push(@$outputArray, "{\n");
    4579             push(@$outputArray, "    ${constructorClassName}* castedThis = jsCast<${constructorClassName}*>(exec->callee());\n");
     4571            push(@$outputArray, "    auto* castedThis = jsCast<${constructorClassName}*>(exec->callee());\n");
    45804572
    45814573            my @constructorArgList;
     
    46074599                push(@$outputArray, "    if (!context)\n");
    46084600                push(@$outputArray, "        return throwConstructorDocumentUnavailableError(*exec, \"${interfaceName}\");\n");
    4609                 push(@$outputArray, "    Document& document = downcast<Document>(*context);\n");
     4601                push(@$outputArray, "    auto& document = downcast<Document>(*context);\n");
    46104602            }
    46114603            if ($generatingNamedConstructor) {
Note: See TracChangeset for help on using the changeset viewer.