<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[160793] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/160793">160793</a></dd>
<dt>Author</dt> <dd>oliver@apple.com</dd>
<dt>Date</dt> <dd>2013-12-18 13:08:35 -0800 (Wed, 18 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactor CodeGeneratorJS - Move attribute function creation out of getOwnPropertyName guard
https://bugs.webkit.org/show_bug.cgi?id=125940

Reviewed by Simon Fraser.

This is just a huge block move of code out from behind the
ImplementationOverridesGetOwnProperty guard.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160792 => 160793)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-18 21:03:14 UTC (rev 160792)
+++ trunk/Source/WebCore/ChangeLog        2013-12-18 21:08:35 UTC (rev 160793)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2013-12-18  Oliver Hunt  &lt;oliver@apple.com&gt;
+
+        Refactor CodeGeneratorJS - Move attribute function creation out of getOwnPropertyName guard
+        https://bugs.webkit.org/show_bug.cgi?id=125940
+
+        Reviewed by Simon Fraser.
+
+        This is just a huge block move of code out from behind the
+        ImplementationOverridesGetOwnProperty guard.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+
</ins><span class="cx"> 2013-12-18  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Frequent ASSERT(hasOneRef()) in SharedBuffer::releasePurgeableBuffer
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (160792 => 160793)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2013-12-18 21:03:14 UTC (rev 160792)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2013-12-18 21:08:35 UTC (rev 160793)
</span><span class="lines">@@ -1874,200 +1874,201 @@
</span><span class="cx">             push(@implContent, &quot;}\n\n&quot;);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ($numAttributes &gt; 0) {
-            foreach my $attribute (@{$interface-&gt;attributes}) {
-                my $name = $attribute-&gt;signature-&gt;name;
-                my $type = $attribute-&gt;signature-&gt;type;
-                my $isNullable = $attribute-&gt;signature-&gt;isNullable;
-                $codeGenerator-&gt;AssertNotSequenceType($type);
-                my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $attribute);
-                my $implGetterFunctionName = $codeGenerator-&gt;WK_lcfirst($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;} || $name);
</del><ins>+    }
+    if ($numAttributes &gt; 0) {
+        foreach my $attribute (@{$interface-&gt;attributes}) {
+            my $name = $attribute-&gt;signature-&gt;name;
+            my $type = $attribute-&gt;signature-&gt;type;
+            my $isNullable = $attribute-&gt;signature-&gt;isNullable;
+            $codeGenerator-&gt;AssertNotSequenceType($type);
+            my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $attribute);
+            my $implGetterFunctionName = $codeGenerator-&gt;WK_lcfirst($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;} || $name);
</ins><span class="cx"> 
</span><del>-                my $attributeConditionalString = $codeGenerator-&gt;GenerateConditionalString($attribute-&gt;signature);
-                push(@implContent, &quot;#if ${attributeConditionalString}\n&quot;) if $attributeConditionalString;
</del><ins>+            my $attributeConditionalString = $codeGenerator-&gt;GenerateConditionalString($attribute-&gt;signature);
+            push(@implContent, &quot;#if ${attributeConditionalString}\n&quot;) if $attributeConditionalString;
</ins><span class="cx"> 
</span><del>-                push(@implContent, &quot;EncodedJSValue ${getFunctionName}(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)\n&quot;);
-                push(@implContent, &quot;{\n&quot;);
</del><ins>+            push(@implContent, &quot;EncodedJSValue ${getFunctionName}(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)\n&quot;);
+            push(@implContent, &quot;{\n&quot;);
</ins><span class="cx"> 
</span><del>-                if (!$attribute-&gt;isStatic || $attribute-&gt;signature-&gt;type =~ /Constructor$/) {
-                    push(@implContent, &quot;    ${className}* castedThis = jsDynamicCast&lt;$className*&gt;(JSValue::decode(slotBase));\n&quot;);
-                } else {
-                    push(@implContent, &quot;    UNUSED_PARAM(slotBase);\n&quot;);
</del><ins>+            if (!$attribute-&gt;isStatic || $attribute-&gt;signature-&gt;type =~ /Constructor$/) {
+                push(@implContent, &quot;    ${className}* castedThis = jsDynamicCast&lt;$className*&gt;(JSValue::decode(slotBase));\n&quot;);
+            } else {
+                push(@implContent, &quot;    UNUSED_PARAM(slotBase);\n&quot;);
+            }
+
+            # Global constructors can be disabled at runtime.
+            if ($attribute-&gt;signature-&gt;type =~ /Constructor$/) {
+                if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;EnabledAtRuntime&quot;}) {
+                    AddToImplIncludes(&quot;RuntimeEnabledFeatures.h&quot;);
+                    my $enable_function = GetRuntimeEnableFunctionName($attribute-&gt;signature);
+                    push(@implContent, &quot;    if (!${enable_function}())\n&quot;);
+                    push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
+                } elsif ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;EnabledBySetting&quot;}) {
+                    AddToImplIncludes(&quot;Frame.h&quot;);
+                    AddToImplIncludes(&quot;Settings.h&quot;);
+                    my $enable_function = ToMethodName($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;EnabledBySetting&quot;}) . &quot;Enabled&quot;;
+                    push(@implContent, &quot;    if (!castedThis-&gt;impl().frame())\n&quot;);
+                    push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
+                    push(@implContent, &quot;    Settings&amp; settings = castedThis-&gt;impl().frame()-&gt;settings();\n&quot;);
+                    push(@implContent, &quot;    if (!settings.$enable_function())\n&quot;);
+                    push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
</ins><span class="cx">                 }
</span><ins>+            }
</ins><span class="cx"> 
</span><del>-                # Global constructors can be disabled at runtime.
-                if ($attribute-&gt;signature-&gt;type =~ /Constructor$/) {
-                    if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;EnabledAtRuntime&quot;}) {
-                        AddToImplIncludes(&quot;RuntimeEnabledFeatures.h&quot;);
-                        my $enable_function = GetRuntimeEnableFunctionName($attribute-&gt;signature);
-                        push(@implContent, &quot;    if (!${enable_function}())\n&quot;);
-                        push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-                    } elsif ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;EnabledBySetting&quot;}) {
-                        AddToImplIncludes(&quot;Frame.h&quot;);
-                        AddToImplIncludes(&quot;Settings.h&quot;);
-                        my $enable_function = ToMethodName($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;EnabledBySetting&quot;}) . &quot;Enabled&quot;;
-                        push(@implContent, &quot;    if (!castedThis-&gt;impl().frame())\n&quot;);
-                        push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-                        push(@implContent, &quot;    Settings&amp; settings = castedThis-&gt;impl().frame()-&gt;settings();\n&quot;);
-                        push(@implContent, &quot;    if (!settings.$enable_function())\n&quot;);
-                        push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-                    }
</del><ins>+            if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CachedAttribute&quot;}) {
+                $needsMarkChildren = 1;
+            }
+
+            if ($interface-&gt;extendedAttributes-&gt;{&quot;CheckSecurity&quot;} &amp;&amp;
+            !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;DoNotCheckSecurity&quot;} &amp;&amp;
+            !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;DoNotCheckSecurityOnGetter&quot;}) {
+                push(@implContent, &quot;    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis-&gt;impl()))\n&quot;);
+                push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
+            }
+
+            if (HasCustomGetter($attribute-&gt;signature-&gt;extendedAttributes)) {
+                push(@implContent, &quot;    return JSValue::encode(castedThis-&gt;$implGetterFunctionName(exec));\n&quot;);
+            } elsif ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CheckSecurityForNode&quot;}) {
+                $implIncludes{&quot;JSDOMBinding.h&quot;} = 1;
+                push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;);
+                push(@implContent, &quot;    return JSValue::encode(shouldAllowAccessToNode(exec, impl.&quot; . $attribute-&gt;signature-&gt;name . &quot;()) ? &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl.$implGetterFunctionName()&quot;, &quot;castedThis&quot;) . &quot; : jsNull());\n&quot;);
+            } elsif ($type eq &quot;EventListener&quot;) {
+                $implIncludes{&quot;EventListener.h&quot;} = 1;
+                push(@implContent, &quot;    UNUSED_PARAM(exec);\n&quot;);
+                push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;);
+                push(@implContent, &quot;    if (EventListener* listener = impl.$implGetterFunctionName()) {\n&quot;);
+                push(@implContent, &quot;        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {\n&quot;);
+                if ($interfaceName eq &quot;Document&quot; || $codeGenerator-&gt;InheritsInterface($interface, &quot;WorkerGlobalScope&quot;)) {
+                    push(@implContent, &quot;            if (JSObject* jsFunction = jsListener-&gt;jsFunction(&amp;impl))\n&quot;);
+                } else {
+                    push(@implContent, &quot;            if (JSObject* jsFunction = jsListener-&gt;jsFunction(impl.scriptExecutionContext()))\n&quot;);
</ins><span class="cx">                 }
</span><ins>+                push(@implContent, &quot;                return JSValue::encode(jsFunction);\n&quot;);
+                push(@implContent, &quot;        }\n&quot;);
+                push(@implContent, &quot;    }\n&quot;);
+                push(@implContent, &quot;    return JSValue::encode(jsNull());\n&quot;);
+            } elsif ($attribute-&gt;signature-&gt;type =~ /Constructor$/) {
+                my $constructorType = $attribute-&gt;signature-&gt;type;
+                $constructorType =~ s/Constructor$//;
+                # When Constructor attribute is used by DOMWindow.idl, it's correct to pass castedThis as the global object
+                # When JSDOMWrappers have a back-pointer to the globalObject we can pass castedThis-&gt;globalObject()
+                if ($interfaceName eq &quot;DOMWindow&quot;) {
+                    my $named = ($constructorType =~ /Named$/) ? &quot;Named&quot; : &quot;&quot;;
+                    $constructorType =~ s/Named$//;
+                    push(@implContent, &quot;    return JSValue::encode(JS&quot; . $constructorType . &quot;::get${named}Constructor(exec-&gt;vm(), castedThis));\n&quot;);
+                } else {
+                    AddToImplIncludes(&quot;JS&quot; . $constructorType . &quot;.h&quot;, $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;});
+                    push(@implContent, &quot;    return JSValue::encode(JS&quot; . $constructorType . &quot;::getConstructor(exec-&gt;vm(), castedThis-&gt;globalObject()));\n&quot;);
+                }
+            } elsif (!$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;GetterRaisesException&quot;}) {
+                push(@implContent, &quot;    UNUSED_PARAM(exec);\n&quot;) if !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CallWith&quot;};
+                push(@implContent, &quot;    bool isNull = false;\n&quot;) if $isNullable;
</ins><span class="cx"> 
</span><ins>+                my $cacheIndex = 0;
</ins><span class="cx">                 if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CachedAttribute&quot;}) {
</span><del>-                    $needsMarkChildren = 1;
</del><ins>+                    $cacheIndex = $currentCachedAttribute;
+                    $currentCachedAttribute++;
+                    push(@implContent, &quot;    if (JSValue cachedValue = castedThis-&gt;m_&quot; . $attribute-&gt;signature-&gt;name . &quot;.get())\n&quot;);
+                    push(@implContent, &quot;        return JSValue::encode(cachedValue);\n&quot;);
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ($interface-&gt;extendedAttributes-&gt;{&quot;CheckSecurity&quot;} &amp;&amp;
-                    !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;DoNotCheckSecurity&quot;} &amp;&amp;
-                    !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;DoNotCheckSecurityOnGetter&quot;}) {
-                    push(@implContent, &quot;    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, castedThis-&gt;impl()))\n&quot;);
-                    push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-                }
</del><ins>+                my @callWithArgs = GenerateCallWith($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CallWith&quot;}, \@implContent, &quot;JSValue::encode(jsUndefined())&quot;);
</ins><span class="cx"> 
</span><del>-                if (HasCustomGetter($attribute-&gt;signature-&gt;extendedAttributes)) {
-                    push(@implContent, &quot;    return JSValue::encode(castedThis-&gt;$implGetterFunctionName(exec));\n&quot;);
-                } elsif ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CheckSecurityForNode&quot;}) {
-                    $implIncludes{&quot;JSDOMBinding.h&quot;} = 1;
-                    push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;);
-                    push(@implContent, &quot;    return JSValue::encode(shouldAllowAccessToNode(exec, impl.&quot; . $attribute-&gt;signature-&gt;name . &quot;()) ? &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl.$implGetterFunctionName()&quot;, &quot;castedThis&quot;) . &quot; : jsNull());\n&quot;);
-                } elsif ($type eq &quot;EventListener&quot;) {
-                    $implIncludes{&quot;EventListener.h&quot;} = 1;
-                    push(@implContent, &quot;    UNUSED_PARAM(exec);\n&quot;);
-                    push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;);
-                    push(@implContent, &quot;    if (EventListener* listener = impl.$implGetterFunctionName()) {\n&quot;);
-                    push(@implContent, &quot;        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {\n&quot;);
-                    if ($interfaceName eq &quot;Document&quot; || $codeGenerator-&gt;InheritsInterface($interface, &quot;WorkerGlobalScope&quot;)) {
-                        push(@implContent, &quot;            if (JSObject* jsFunction = jsListener-&gt;jsFunction(&amp;impl))\n&quot;);
</del><ins>+                if ($svgListPropertyType) {
+                    push(@implContent, &quot;    JSValue result =  &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;castedThis-&gt;impl().$implGetterFunctionName(&quot; . (join &quot;, &quot;, @callWithArgs) . &quot;)&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
+                } elsif ($svgPropertyOrListPropertyType) {
+                    push(@implContent, &quot;    $svgPropertyOrListPropertyType&amp; impl = castedThis-&gt;impl().propertyReference();\n&quot;);
+                    if ($svgPropertyOrListPropertyType eq &quot;float&quot;) { # Special case for JSSVGNumber
+                        push(@implContent, &quot;    JSValue result = &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
</ins><span class="cx">                     } else {
</span><del>-                        push(@implContent, &quot;            if (JSObject* jsFunction = jsListener-&gt;jsFunction(impl.scriptExecutionContext()))\n&quot;);
-                    }
-                    push(@implContent, &quot;                return JSValue::encode(jsFunction);\n&quot;);
-                    push(@implContent, &quot;        }\n&quot;);
-                    push(@implContent, &quot;    }\n&quot;);
-                    push(@implContent, &quot;    return JSValue::encode(jsNull());\n&quot;);
-                } elsif ($attribute-&gt;signature-&gt;type =~ /Constructor$/) {
-                    my $constructorType = $attribute-&gt;signature-&gt;type;
-                    $constructorType =~ s/Constructor$//;
-                    # When Constructor attribute is used by DOMWindow.idl, it's correct to pass castedThis as the global object
-                    # When JSDOMWrappers have a back-pointer to the globalObject we can pass castedThis-&gt;globalObject()
-                    if ($interfaceName eq &quot;DOMWindow&quot;) {
-                        my $named = ($constructorType =~ /Named$/) ? &quot;Named&quot; : &quot;&quot;;
-                        $constructorType =~ s/Named$//;
-                        push(@implContent, &quot;    return JSValue::encode(JS&quot; . $constructorType . &quot;::get${named}Constructor(exec-&gt;vm(), castedThis));\n&quot;);
-                    } else {
-                       AddToImplIncludes(&quot;JS&quot; . $constructorType . &quot;.h&quot;, $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;});
-                       push(@implContent, &quot;    return JSValue::encode(JS&quot; . $constructorType . &quot;::getConstructor(exec-&gt;vm(), castedThis-&gt;globalObject()));\n&quot;);
-                    }
-                } elsif (!$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;GetterRaisesException&quot;}) {
-                    push(@implContent, &quot;    UNUSED_PARAM(exec);\n&quot;) if !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CallWith&quot;};
-                    push(@implContent, &quot;    bool isNull = false;\n&quot;) if $isNullable;
</del><ins>+                        push(@implContent, &quot;    JSValue result = &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl.$implGetterFunctionName(&quot; . (join &quot;, &quot;, @callWithArgs) . &quot;)&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
</ins><span class="cx"> 
</span><del>-                    my $cacheIndex = 0;
-                    if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CachedAttribute&quot;}) {
-                        $cacheIndex = $currentCachedAttribute;
-                        $currentCachedAttribute++;
-                        push(@implContent, &quot;    if (JSValue cachedValue = castedThis-&gt;m_&quot; . $attribute-&gt;signature-&gt;name . &quot;.get())\n&quot;);
-                        push(@implContent, &quot;        return JSValue::encode(cachedValue);\n&quot;);
</del><span class="cx">                     }
</span><del>-
-                    my @callWithArgs = GenerateCallWith($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CallWith&quot;}, \@implContent, &quot;JSValue::encode(jsUndefined())&quot;);
-
-                    if ($svgListPropertyType) {
-                        push(@implContent, &quot;    JSValue result =  &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;castedThis-&gt;impl().$implGetterFunctionName(&quot; . (join &quot;, &quot;, @callWithArgs) . &quot;)&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
-                    } elsif ($svgPropertyOrListPropertyType) {
-                        push(@implContent, &quot;    $svgPropertyOrListPropertyType&amp; impl = castedThis-&gt;impl().propertyReference();\n&quot;);
-                        if ($svgPropertyOrListPropertyType eq &quot;float&quot;) { # Special case for JSSVGNumber
-                            push(@implContent, &quot;    JSValue result = &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
-                        } else {
-                            push(@implContent, &quot;    JSValue result = &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl.$implGetterFunctionName(&quot; . (join &quot;, &quot;, @callWithArgs) . &quot;)&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
-
-                        }
</del><ins>+                } else {
+                    my ($functionName, @arguments) = $codeGenerator-&gt;GetterExpression(\%implIncludes, $interfaceName, $attribute);
+                    push(@arguments, &quot;isNull&quot;) if $isNullable;
+                    if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedBy&quot;}) {
+                        my $implementedBy = $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedBy&quot;};
+                        $implIncludes{&quot;${implementedBy}.h&quot;} = 1;
+                        $functionName = &quot;${implementedBy}::${functionName}&quot;;
+                        unshift(@arguments, &quot;&amp;impl&quot;) if !$attribute-&gt;isStatic;
+                    } elsif ($attribute-&gt;isStatic) {
+                        $functionName = &quot;${interfaceName}::${functionName}&quot;;
</ins><span class="cx">                     } else {
</span><del>-                        my ($functionName, @arguments) = $codeGenerator-&gt;GetterExpression(\%implIncludes, $interfaceName, $attribute);
-                        push(@arguments, &quot;isNull&quot;) if $isNullable;
-                        if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedBy&quot;}) {
-                            my $implementedBy = $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedBy&quot;};
-                            $implIncludes{&quot;${implementedBy}.h&quot;} = 1;
-                            $functionName = &quot;${implementedBy}::${functionName}&quot;;
-                            unshift(@arguments, &quot;&amp;impl&quot;) if !$attribute-&gt;isStatic;
-                        } elsif ($attribute-&gt;isStatic) {
-                            $functionName = &quot;${interfaceName}::${functionName}&quot;;
-                        } else {
-                            $functionName = &quot;impl.${functionName}&quot;;
-                        }
-
-                        unshift(@arguments, @callWithArgs);
-                        my $jsType = NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;${functionName}(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;, &quot;castedThis&quot;);
-                        push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;) if !$attribute-&gt;isStatic;
-                        if ($codeGenerator-&gt;IsSVGAnimatedType($type)) {
-                            push(@implContent, &quot;    RefPtr&lt;$type&gt; obj = $jsType;\n&quot;);
-                            push(@implContent, &quot;    JSValue result =  toJS(exec, castedThis-&gt;globalObject(), obj.get());\n&quot;);
-                        } else {
-                            push(@implContent, &quot;    JSValue result = $jsType;\n&quot;);
-                        }
-
-                        if ($isNullable) {
-                            push(@implContent, &quot;    if (isNull)\n&quot;);
-                            push(@implContent, &quot;        return JSValue::encode(jsNull());\n&quot;);
-                        }
</del><ins>+                        $functionName = &quot;impl.${functionName}&quot;;
</ins><span class="cx">                     }
</span><span class="cx"> 
</span><del>-                    push(@implContent, &quot;    castedThis-&gt;m_&quot; . $attribute-&gt;signature-&gt;name . &quot;.set(exec-&gt;vm(), castedThis, result);\n&quot;) if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CachedAttribute&quot;});
-                    push(@implContent, &quot;    return JSValue::encode(result);\n&quot;);
-
-                } else {
-                    my @arguments = (&quot;ec&quot;);
-                    push(@implContent, &quot;    ExceptionCode ec = 0;\n&quot;);
-
-                    if ($isNullable) {
-                        push(@implContent, &quot;    bool isNull = false;\n&quot;);
-                        unshift(@arguments, &quot;isNull&quot;);
-                    }
-
-                    unshift(@arguments, GenerateCallWith($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CallWith&quot;}, \@implContent, &quot;JSValue::encode(jsUndefined())&quot;));
-
-                    if ($svgPropertyOrListPropertyType) {
-                        push(@implContent, &quot;    $svgPropertyOrListPropertyType impl(*castedThis-&gt;impl());\n&quot;);
-                        push(@implContent, &quot;    JSC::JSValue result = &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl.$implGetterFunctionName(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
</del><ins>+                    unshift(@arguments, @callWithArgs);
+                    my $jsType = NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;${functionName}(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;, &quot;castedThis&quot;);
+                    push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;) if !$attribute-&gt;isStatic;
+                    if ($codeGenerator-&gt;IsSVGAnimatedType($type)) {
+                        push(@implContent, &quot;    RefPtr&lt;$type&gt; obj = $jsType;\n&quot;);
+                        push(@implContent, &quot;    JSValue result =  toJS(exec, castedThis-&gt;globalObject(), obj.get());\n&quot;);
</ins><span class="cx">                     } else {
</span><del>-                        push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;);
-                        push(@implContent, &quot;    JSC::JSValue result = &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl.$implGetterFunctionName(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
</del><ins>+                        push(@implContent, &quot;    JSValue result = $jsType;\n&quot;);
</ins><span class="cx">                     }
</span><span class="cx"> 
</span><span class="cx">                     if ($isNullable) {
</span><span class="cx">                         push(@implContent, &quot;    if (isNull)\n&quot;);
</span><span class="cx">                         push(@implContent, &quot;        return JSValue::encode(jsNull());\n&quot;);
</span><span class="cx">                     }
</span><ins>+                }
</ins><span class="cx"> 
</span><del>-                    push(@implContent, &quot;    setDOMException(exec, ec);\n&quot;);
-                    push(@implContent, &quot;    return JSValue::encode(result);\n&quot;);
</del><ins>+                push(@implContent, &quot;    castedThis-&gt;m_&quot; . $attribute-&gt;signature-&gt;name . &quot;.set(exec-&gt;vm(), castedThis, result);\n&quot;) if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CachedAttribute&quot;});
+                push(@implContent, &quot;    return JSValue::encode(result);\n&quot;);
+
+            } else {
+                my @arguments = (&quot;ec&quot;);
+                push(@implContent, &quot;    ExceptionCode ec = 0;\n&quot;);
+
+                if ($isNullable) {
+                    push(@implContent, &quot;    bool isNull = false;\n&quot;);
+                    unshift(@arguments, &quot;isNull&quot;);
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                push(@implContent, &quot;}\n\n&quot;);
</del><ins>+                unshift(@arguments, GenerateCallWith($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CallWith&quot;}, \@implContent, &quot;JSValue::encode(jsUndefined())&quot;));
</ins><span class="cx"> 
</span><del>-                push(@implContent, &quot;#endif\n&quot;) if $attributeConditionalString;
</del><ins>+                if ($svgPropertyOrListPropertyType) {
+                    push(@implContent, &quot;    $svgPropertyOrListPropertyType impl(*castedThis-&gt;impl());\n&quot;);
+                    push(@implContent, &quot;    JSC::JSValue result = &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl.$implGetterFunctionName(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
+                } else {
+                    push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;);
+                    push(@implContent, &quot;    JSC::JSValue result = &quot; . NativeToJSValue($attribute-&gt;signature, 0, $interfaceName, &quot;impl.$implGetterFunctionName(&quot; . join(&quot;, &quot;, @arguments) . &quot;)&quot;, &quot;castedThis&quot;) . &quot;;\n&quot;);
+                }
</ins><span class="cx"> 
</span><del>-                push(@implContent, &quot;\n&quot;);
</del><ins>+                if ($isNullable) {
+                    push(@implContent, &quot;    if (isNull)\n&quot;);
+                    push(@implContent, &quot;        return JSValue::encode(jsNull());\n&quot;);
+                }
+
+                push(@implContent, &quot;    setDOMException(exec, ec);\n&quot;);
+                push(@implContent, &quot;    return JSValue::encode(result);\n&quot;);
</ins><span class="cx">             }
</span><span class="cx"> 
</span><del>-            if (!$interface-&gt;extendedAttributes-&gt;{&quot;NoInterfaceObject&quot;}) {
-                my $constructorFunctionName = &quot;js&quot; . $interfaceName . &quot;Constructor&quot;;
</del><ins>+            push(@implContent, &quot;}\n\n&quot;);
</ins><span class="cx"> 
</span><del>-                push(@implContent, &quot;EncodedJSValue ${constructorFunctionName}(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)\n&quot;);
-                push(@implContent, &quot;{\n&quot;);
-                push(@implContent, &quot;    ${className}* domObject = jsDynamicCast&lt;$className*&gt;(JSValue::decode(slotBase));\n&quot;);
</del><ins>+            push(@implContent, &quot;#endif\n&quot;) if $attributeConditionalString;
</ins><span class="cx"> 
</span><del>-                if ($interface-&gt;extendedAttributes-&gt;{&quot;CheckSecurity&quot;}) {
-                    push(@implContent, &quot;    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, domObject-&gt;impl()))\n&quot;);
-                    push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
-                }
</del><ins>+            push(@implContent, &quot;\n&quot;);
+        }
</ins><span class="cx"> 
</span><del>-                push(@implContent, &quot;    return JSValue::encode(${className}::getConstructor(exec-&gt;vm(), domObject-&gt;globalObject()));\n&quot;);
-                push(@implContent, &quot;}\n\n&quot;);
</del><ins>+        if (!$interface-&gt;extendedAttributes-&gt;{&quot;NoInterfaceObject&quot;}) {
+            my $constructorFunctionName = &quot;js&quot; . $interfaceName . &quot;Constructor&quot;;
+
+            push(@implContent, &quot;EncodedJSValue ${constructorFunctionName}(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)\n&quot;);
+            push(@implContent, &quot;{\n&quot;);
+            push(@implContent, &quot;    ${className}* domObject = jsDynamicCast&lt;$className*&gt;(JSValue::decode(slotBase));\n&quot;);
+
+            if ($interface-&gt;extendedAttributes-&gt;{&quot;CheckSecurity&quot;}) {
+                push(@implContent, &quot;    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, domObject-&gt;impl()))\n&quot;);
+                push(@implContent, &quot;        return JSValue::encode(jsUndefined());\n&quot;);
</ins><span class="cx">             }
</span><ins>+
+            push(@implContent, &quot;    return JSValue::encode(${className}::getConstructor(exec-&gt;vm(), domObject-&gt;globalObject()));\n&quot;);
+            push(@implContent, &quot;}\n\n&quot;);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">         # Check if we have any writable attributes
</span><span class="cx">         my $hasReadWriteProperties = 0;
</span><span class="cx">         foreach my $attribute (@{$interface-&gt;attributes}) {
</span><span class="lines">@@ -2075,8 +2076,8 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         my $hasSetter = $hasReadWriteProperties
</span><del>-                     || $interface-&gt;extendedAttributes-&gt;{&quot;CustomNamedSetter&quot;}
-                     || $interface-&gt;extendedAttributes-&gt;{&quot;CustomIndexedSetter&quot;};
</del><ins>+        || $interface-&gt;extendedAttributes-&gt;{&quot;CustomNamedSetter&quot;}
+        || $interface-&gt;extendedAttributes-&gt;{&quot;CustomIndexedSetter&quot;};
</ins><span class="cx"> 
</span><span class="cx">         if ($hasSetter) {
</span><span class="cx">             if (!$interface-&gt;extendedAttributes-&gt;{&quot;CustomPutFunction&quot;}) {
</span><span class="lines">@@ -2102,7 +2103,7 @@
</span><span class="cx">                     push(@implContent, &quot;    Base::put(thisObject, exec, propertyName, value, slot);\n&quot;);
</span><span class="cx">                 }
</span><span class="cx">                 push(@implContent, &quot;}\n\n&quot;);
</span><del>-                
</del><ins>+
</ins><span class="cx">                 if ($interface-&gt;extendedAttributes-&gt;{&quot;CustomIndexedSetter&quot;} || $interface-&gt;extendedAttributes-&gt;{&quot;CustomNamedSetter&quot;}) {
</span><span class="cx">                     push(@implContent, &quot;void ${className}::putByIndex(JSCell* cell, ExecState* exec, unsigned index, JSValue value, bool shouldThrow)\n&quot;);
</span><span class="cx">                     push(@implContent, &quot;{\n&quot;);
</span><span class="lines">@@ -2115,14 +2116,14 @@
</span><span class="cx">                         push(@implContent, &quot;        return;\n&quot;);
</span><span class="cx">                         push(@implContent, &quot;    }\n&quot;);
</span><span class="cx">                     }
</span><del>-                    
</del><ins>+
</ins><span class="cx">                     if ($interface-&gt;extendedAttributes-&gt;{&quot;CustomNamedSetter&quot;}) {
</span><span class="cx">                         push(@implContent, &quot;    PropertyName propertyName = Identifier::from(exec, index);\n&quot;);
</span><span class="cx">                         push(@implContent, &quot;    PutPropertySlot slot(shouldThrow);\n&quot;);
</span><span class="cx">                         push(@implContent, &quot;    if (thisObject-&gt;putDelegate(exec, propertyName, value, slot))\n&quot;);
</span><span class="cx">                         push(@implContent, &quot;        return;\n&quot;);
</span><span class="cx">                     }
</span><del>-    
</del><ins>+
</ins><span class="cx">                     push(@implContent, &quot;    Base::putByIndex(cell, exec, index, value, shouldThrow);\n&quot;);
</span><span class="cx">                     push(@implContent, &quot;}\n\n&quot;);
</span><span class="cx">                 }
</span><span class="lines">@@ -2145,141 +2146,141 @@
</span><span class="cx">                         push(@implContent, &quot;, JSValue value)\n&quot;);
</span><span class="cx">                         push(@implContent, &quot;{\n&quot;);
</span><span class="cx"> 
</span><del>-                            push(@implContent, &quot;    UNUSED_PARAM(exec);\n&quot;);
</del><ins>+                        push(@implContent, &quot;    UNUSED_PARAM(exec);\n&quot;);
</ins><span class="cx"> 
</span><del>-                            if ($interface-&gt;extendedAttributes-&gt;{&quot;CheckSecurity&quot;} &amp;&amp; !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;DoNotCheckSecurity&quot;}) {
-                                if ($interfaceName eq &quot;DOMWindow&quot;) {
-                                    push(@implContent, &quot;    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, jsCast&lt;$className*&gt;(thisObject)-&gt;impl()))\n&quot;);
-                                } else {
-                                    push(@implContent, &quot;    if (!shouldAllowAccessToFrame(exec, jsCast&lt;$className*&gt;(thisObject)-&gt;impl().frame()))\n&quot;);
-                                }
-                                push(@implContent, &quot;        return;\n&quot;);
</del><ins>+                        if ($interface-&gt;extendedAttributes-&gt;{&quot;CheckSecurity&quot;} &amp;&amp; !$attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;DoNotCheckSecurity&quot;}) {
+                            if ($interfaceName eq &quot;DOMWindow&quot;) {
+                                push(@implContent, &quot;    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, jsCast&lt;$className*&gt;(thisObject)-&gt;impl()))\n&quot;);
+                            } else {
+                                push(@implContent, &quot;    if (!shouldAllowAccessToFrame(exec, jsCast&lt;$className*&gt;(thisObject)-&gt;impl().frame()))\n&quot;);
</ins><span class="cx">                             }
</span><ins>+                            push(@implContent, &quot;        return;\n&quot;);
+                        }
</ins><span class="cx"> 
</span><del>-                            if (HasCustomSetter($attribute-&gt;signature-&gt;extendedAttributes)) {
-                                push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;set$implSetterFunctionName(exec, value);\n&quot;);
-                            } elsif ($type eq &quot;EventListener&quot;) {
-                                $implIncludes{&quot;JSEventListener.h&quot;} = 1;
-                                push(@implContent, &quot;    UNUSED_PARAM(exec);\n&quot;);
-                                push(@implContent, &quot;    ${className}* castedThis = jsCast&lt;${className}*&gt;(thisObject);\n&quot;);
-                                my $windowEventListener = $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;JSWindowEventListener&quot;};
-                                if ($windowEventListener) {
-                                    push(@implContent, &quot;    JSDOMGlobalObject* globalObject = castedThis-&gt;globalObject();\n&quot;);
-                                }
-                                push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;);
-                                if ((($interfaceName eq &quot;DOMWindow&quot;) or ($interfaceName eq &quot;WorkerGlobalScope&quot;)) and $name eq &quot;onerror&quot;) {
-                                    $implIncludes{&quot;JSErrorHandler.h&quot;} = 1;
-                                    push(@implContent, &quot;    impl.set$implSetterFunctionName(createJSErrorHandler(exec, value, thisObject));\n&quot;);
-                                } else {
-                                    push(@implContent, GenerateAttributeEventListenerCall($className, $implSetterFunctionName, $windowEventListener));
-                                }
-                            } elsif ($attribute-&gt;signature-&gt;type =~ /Constructor$/) {
-                                my $constructorType = $attribute-&gt;signature-&gt;type;
-                                $constructorType =~ s/Constructor$//;
-                                # $constructorType ~= /Constructor$/ indicates that it is NamedConstructor.
-                                # We do not generate the header file for NamedConstructor of class XXXX,
-                                # since we generate the NamedConstructor declaration into the header file of class XXXX.
-                                if ($constructorType ne &quot;any&quot; and $constructorType !~ /Named$/) {
-                                    AddToImplIncludes(&quot;JS&quot; . $constructorType . &quot;.h&quot;, $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;});
-                                }
-                                push(@implContent, &quot;    // Shadowing a built-in constructor\n&quot;);
-                                if ($interfaceName eq &quot;DOMWindow&quot; &amp;&amp; $className eq &quot;JSblah&quot;) {
-                                    # FIXME: This branch never executes and should be removed.
-                                    push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().constructor, value);\n&quot;);
-                                } else {
-                                    push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;putDirect(exec-&gt;vm(), Identifier(exec, \&quot;$name\&quot;), value);\n&quot;);
-                                }
-                            } elsif ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Replaceable&quot;}) {
-                                push(@implContent, &quot;    // Shadowing a built-in object\n&quot;);
</del><ins>+                        if (HasCustomSetter($attribute-&gt;signature-&gt;extendedAttributes)) {
+                            push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;set$implSetterFunctionName(exec, value);\n&quot;);
+                        } elsif ($type eq &quot;EventListener&quot;) {
+                            $implIncludes{&quot;JSEventListener.h&quot;} = 1;
+                            push(@implContent, &quot;    UNUSED_PARAM(exec);\n&quot;);
+                            push(@implContent, &quot;    ${className}* castedThis = jsCast&lt;${className}*&gt;(thisObject);\n&quot;);
+                            my $windowEventListener = $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;JSWindowEventListener&quot;};
+                            if ($windowEventListener) {
+                                push(@implContent, &quot;    JSDOMGlobalObject* globalObject = castedThis-&gt;globalObject();\n&quot;);
+                            }
+                            push(@implContent, &quot;    $interfaceName&amp; impl = castedThis-&gt;impl();\n&quot;);
+                            if ((($interfaceName eq &quot;DOMWindow&quot;) or ($interfaceName eq &quot;WorkerGlobalScope&quot;)) and $name eq &quot;onerror&quot;) {
+                                $implIncludes{&quot;JSErrorHandler.h&quot;} = 1;
+                                push(@implContent, &quot;    impl.set$implSetterFunctionName(createJSErrorHandler(exec, value, thisObject));\n&quot;);
+                            } else {
+                                push(@implContent, GenerateAttributeEventListenerCall($className, $implSetterFunctionName, $windowEventListener));
+                            }
+                        } elsif ($attribute-&gt;signature-&gt;type =~ /Constructor$/) {
+                            my $constructorType = $attribute-&gt;signature-&gt;type;
+                            $constructorType =~ s/Constructor$//;
+                            # $constructorType ~= /Constructor$/ indicates that it is NamedConstructor.
+                            # We do not generate the header file for NamedConstructor of class XXXX,
+                            # since we generate the NamedConstructor declaration into the header file of class XXXX.
+                            if ($constructorType ne &quot;any&quot; and $constructorType !~ /Named$/) {
+                                AddToImplIncludes(&quot;JS&quot; . $constructorType . &quot;.h&quot;, $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Conditional&quot;});
+                            }
+                            push(@implContent, &quot;    // Shadowing a built-in constructor\n&quot;);
+                            if ($interfaceName eq &quot;DOMWindow&quot; &amp;&amp; $className eq &quot;JSblah&quot;) {
+                                # FIXME: This branch never executes and should be removed.
+                                push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().constructor, value);\n&quot;);
+                            } else {
</ins><span class="cx">                                 push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;putDirect(exec-&gt;vm(), Identifier(exec, \&quot;$name\&quot;), value);\n&quot;);
</span><del>-                            } else {
-                                if (!$attribute-&gt;isStatic) {
-                                    push(@implContent, &quot;    $className* castedThis = jsCast&lt;$className*&gt;(thisObject);\n&quot;);
-                                    push(@implContent, &quot;    $implType&amp; impl = castedThis-&gt;impl();\n&quot;);
-                                }
-                                push(@implContent, &quot;    ExceptionCode ec = 0;\n&quot;) if $setterRaisesException;
</del><ins>+                            }
+                        } elsif ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;Replaceable&quot;}) {
+                            push(@implContent, &quot;    // Shadowing a built-in object\n&quot;);
+                            push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;putDirect(exec-&gt;vm(), Identifier(exec, \&quot;$name\&quot;), value);\n&quot;);
+                        } else {
+                            if (!$attribute-&gt;isStatic) {
+                                push(@implContent, &quot;    $className* castedThis = jsCast&lt;$className*&gt;(thisObject);\n&quot;);
+                                push(@implContent, &quot;    $implType&amp; impl = castedThis-&gt;impl();\n&quot;);
+                            }
+                            push(@implContent, &quot;    ExceptionCode ec = 0;\n&quot;) if $setterRaisesException;
</ins><span class="cx"> 
</span><del>-                                # If the &quot;StrictTypeChecking&quot; extended attribute is present, and the attribute's type is an
-                                # interface type, then if the incoming value does not implement that interface, a TypeError
-                                # is thrown rather than silently passing NULL to the C++ code.
-                                # Per the Web IDL and ECMAScript specifications, incoming values can always be converted to
-                                # both strings and numbers, so do not throw TypeError if the attribute is of these types.
-                                if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;StrictTypeChecking&quot;}) {
-                                    $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
</del><ins>+                            # If the &quot;StrictTypeChecking&quot; extended attribute is present, and the attribute's type is an
+                            # interface type, then if the incoming value does not implement that interface, a TypeError
+                            # is thrown rather than silently passing NULL to the C++ code.
+                            # Per the Web IDL and ECMAScript specifications, incoming values can always be converted to
+                            # both strings and numbers, so do not throw TypeError if the attribute is of these types.
+                            if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;StrictTypeChecking&quot;}) {
+                                $implIncludes{&quot;&lt;runtime/Error.h&gt;&quot;} = 1;
</ins><span class="cx"> 
</span><del>-                                    my $argType = $attribute-&gt;signature-&gt;type;
-                                    if ($codeGenerator-&gt;IsWrapperType($argType)) {
-                                        push(@implContent, &quot;    if (!value.isUndefinedOrNull() &amp;&amp; !value.inherits(JS${argType}::info())) {\n&quot;);
-                                        push(@implContent, &quot;        throwVMTypeError(exec);\n&quot;);
-                                        push(@implContent, &quot;        return;\n&quot;);
-                                        push(@implContent, &quot;    };\n&quot;);
-                                    }
</del><ins>+                                my $argType = $attribute-&gt;signature-&gt;type;
+                                if ($codeGenerator-&gt;IsWrapperType($argType)) {
+                                    push(@implContent, &quot;    if (!value.isUndefinedOrNull() &amp;&amp; !value.inherits(JS${argType}::info())) {\n&quot;);
+                                    push(@implContent, &quot;        throwVMTypeError(exec);\n&quot;);
+                                    push(@implContent, &quot;        return;\n&quot;);
+                                    push(@implContent, &quot;    };\n&quot;);
</ins><span class="cx">                                 }
</span><ins>+                            }
</ins><span class="cx"> 
</span><del>-                                push(@implContent, &quot;    &quot; . GetNativeTypeFromSignature($attribute-&gt;signature) . &quot; nativeValue(&quot; . JSValueToNative($attribute-&gt;signature, &quot;value&quot;) . &quot;);\n&quot;);
-                                push(@implContent, &quot;    if (exec-&gt;hadException())\n&quot;);
-                                push(@implContent, &quot;        return;\n&quot;);
</del><ins>+                            push(@implContent, &quot;    &quot; . GetNativeTypeFromSignature($attribute-&gt;signature) . &quot; nativeValue(&quot; . JSValueToNative($attribute-&gt;signature, &quot;value&quot;) . &quot;);\n&quot;);
+                            push(@implContent, &quot;    if (exec-&gt;hadException())\n&quot;);
+                            push(@implContent, &quot;        return;\n&quot;);
</ins><span class="cx"> 
</span><del>-                                if ($codeGenerator-&gt;IsEnumType($type)) {
-                                    my @enumValues = $codeGenerator-&gt;ValidEnumValues($type);
-                                    my @enumChecks = ();
-                                    foreach my $enumValue (@enumValues) {
-                                        push(@enumChecks, &quot;nativeValue != \&quot;$enumValue\&quot;&quot;);
-                                    }
-                                    push (@implContent, &quot;    if (&quot; . join(&quot; &amp;&amp; &quot;, @enumChecks) . &quot;)\n&quot;);
-                                    push (@implContent, &quot;        return;\n&quot;);
</del><ins>+                            if ($codeGenerator-&gt;IsEnumType($type)) {
+                                my @enumValues = $codeGenerator-&gt;ValidEnumValues($type);
+                                my @enumChecks = ();
+                                foreach my $enumValue (@enumValues) {
+                                    push(@enumChecks, &quot;nativeValue != \&quot;$enumValue\&quot;&quot;);
</ins><span class="cx">                                 }
</span><ins>+                                push (@implContent, &quot;    if (&quot; . join(&quot; &amp;&amp; &quot;, @enumChecks) . &quot;)\n&quot;);
+                                push (@implContent, &quot;        return;\n&quot;);
+                            }
</ins><span class="cx"> 
</span><del>-                                if ($svgPropertyOrListPropertyType) {
-                                    if ($svgPropertyType) {
-                                        push(@implContent, &quot;    if (impl.isReadOnly()) {\n&quot;);
-                                        push(@implContent, &quot;        setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);\n&quot;);
-                                        push(@implContent, &quot;        return;\n&quot;);
-                                        push(@implContent, &quot;    }\n&quot;);
-                                        $implIncludes{&quot;ExceptionCode.h&quot;} = 1;
-                                    }
-                                    push(@implContent, &quot;    $svgPropertyOrListPropertyType&amp; podImpl = impl.propertyReference();\n&quot;);
-                                    if ($svgPropertyOrListPropertyType eq &quot;float&quot;) { # Special case for JSSVGNumber
-                                        push(@implContent, &quot;    podImpl = nativeValue;\n&quot;);
</del><ins>+                            if ($svgPropertyOrListPropertyType) {
+                                if ($svgPropertyType) {
+                                    push(@implContent, &quot;    if (impl.isReadOnly()) {\n&quot;);
+                                    push(@implContent, &quot;        setDOMException(exec, NO_MODIFICATION_ALLOWED_ERR);\n&quot;);
+                                    push(@implContent, &quot;        return;\n&quot;);
+                                    push(@implContent, &quot;    }\n&quot;);
+                                    $implIncludes{&quot;ExceptionCode.h&quot;} = 1;
+                                }
+                                push(@implContent, &quot;    $svgPropertyOrListPropertyType&amp; podImpl = impl.propertyReference();\n&quot;);
+                                if ($svgPropertyOrListPropertyType eq &quot;float&quot;) { # Special case for JSSVGNumber
+                                    push(@implContent, &quot;    podImpl = nativeValue;\n&quot;);
+                                } else {
+                                    push(@implContent, &quot;    podImpl.set$implSetterFunctionName(nativeValue&quot;);
+                                    push(@implContent, &quot;, ec&quot;) if $setterRaisesException;
+                                    push(@implContent, &quot;);\n&quot;);
+                                    push(@implContent, &quot;    setDOMException(exec, ec);\n&quot;) if $setterRaisesException;
+                                }
+                                if ($svgPropertyType) {
+                                    if ($setterRaisesException) {
+                                        push(@implContent, &quot;    if (!ec)\n&quot;);
+                                        push(@implContent, &quot;        impl.commitChange();\n&quot;);
</ins><span class="cx">                                     } else {
</span><del>-                                        push(@implContent, &quot;    podImpl.set$implSetterFunctionName(nativeValue&quot;);
-                                        push(@implContent, &quot;, ec&quot;) if $setterRaisesException;
-                                        push(@implContent, &quot;);\n&quot;);
-                                        push(@implContent, &quot;    setDOMException(exec, ec);\n&quot;) if $setterRaisesException;
</del><ins>+                                        push(@implContent, &quot;    impl.commitChange();\n&quot;);
</ins><span class="cx">                                     }
</span><del>-                                    if ($svgPropertyType) {
-                                        if ($setterRaisesException) {
-                                            push(@implContent, &quot;    if (!ec)\n&quot;);
-                                            push(@implContent, &quot;        impl.commitChange();\n&quot;);
-                                        } else {
-                                            push(@implContent, &quot;    impl.commitChange();\n&quot;);
-                                        }
-                                    }
</del><ins>+                                }
+                            } else {
+                                my ($functionName, @arguments) = $codeGenerator-&gt;SetterExpression(\%implIncludes, $interfaceName, $attribute);
+                                if ($codeGenerator-&gt;IsTypedArrayType($attribute-&gt;signature-&gt;type) and not $attribute-&gt;signature-&gt;type eq &quot;ArrayBuffer&quot;) {
+                                    push(@arguments, &quot;nativeValue.get()&quot;);
</ins><span class="cx">                                 } else {
</span><del>-                                    my ($functionName, @arguments) = $codeGenerator-&gt;SetterExpression(\%implIncludes, $interfaceName, $attribute);
-                                    if ($codeGenerator-&gt;IsTypedArrayType($attribute-&gt;signature-&gt;type) and not $attribute-&gt;signature-&gt;type eq &quot;ArrayBuffer&quot;) {
-                                        push(@arguments, &quot;nativeValue.get()&quot;);
-                                    } else {
-                                        push(@arguments, &quot;nativeValue&quot;);
-                                    }
-                                    if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedBy&quot;}) {
-                                        my $implementedBy = $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedBy&quot;};
-                                        $implIncludes{&quot;${implementedBy}.h&quot;} = 1;
-                                        unshift(@arguments, &quot;&amp;impl&quot;) if !$attribute-&gt;isStatic;
-                                        $functionName = &quot;${implementedBy}::${functionName}&quot;;
-                                    } elsif ($attribute-&gt;isStatic) {
-                                        $functionName = &quot;${interfaceName}::${functionName}&quot;;
-                                    } else {
-                                        $functionName = &quot;impl.${functionName}&quot;;
-                                    }
</del><ins>+                                    push(@arguments, &quot;nativeValue&quot;);
+                                }
+                                if ($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedBy&quot;}) {
+                                    my $implementedBy = $attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;ImplementedBy&quot;};
+                                    $implIncludes{&quot;${implementedBy}.h&quot;} = 1;
+                                    unshift(@arguments, &quot;&amp;impl&quot;) if !$attribute-&gt;isStatic;
+                                    $functionName = &quot;${implementedBy}::${functionName}&quot;;
+                                } elsif ($attribute-&gt;isStatic) {
+                                    $functionName = &quot;${interfaceName}::${functionName}&quot;;
+                                } else {
+                                    $functionName = &quot;impl.${functionName}&quot;;
+                                }
</ins><span class="cx"> 
</span><del>-                                    unshift(@arguments, GenerateCallWith($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CallWith&quot;}, \@implContent, &quot;&quot;));
</del><ins>+                                unshift(@arguments, GenerateCallWith($attribute-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CallWith&quot;}, \@implContent, &quot;&quot;));
</ins><span class="cx"> 
</span><del>-                                    push(@arguments, &quot;ec&quot;) if $setterRaisesException;
-                                    push(@implContent, &quot;    ${functionName}(&quot; . join(&quot;, &quot;, @arguments) . &quot;);\n&quot;);
-                                    push(@implContent, &quot;    setDOMException(exec, ec);\n&quot;) if $setterRaisesException;
-                                }
</del><ins>+                                push(@arguments, &quot;ec&quot;) if $setterRaisesException;
+                                push(@implContent, &quot;    ${functionName}(&quot; . join(&quot;, &quot;, @arguments) . &quot;);\n&quot;);
+                                push(@implContent, &quot;    setDOMException(exec, ec);\n&quot;) if $setterRaisesException;
</ins><span class="cx">                             }
</span><ins>+                        }
</ins><span class="cx"> 
</span><span class="cx">                         push(@implContent, &quot;}\n\n&quot;);
</span><span class="cx">                         push(@implContent, &quot;#endif\n&quot;) if $attributeConditionalString;
</span><span class="lines">@@ -2287,30 +2288,30 @@
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx">             }
</span><ins>+        }
</ins><span class="cx"> 
</span><del>-            if ($interface-&gt;extendedAttributes-&gt;{&quot;ReplaceableConstructor&quot;}) {
-                my $constructorFunctionName = &quot;setJS&quot; . $interfaceName . &quot;Constructor&quot;;
</del><ins>+        if ($interface-&gt;extendedAttributes-&gt;{&quot;ReplaceableConstructor&quot;}) {
+            my $constructorFunctionName = &quot;setJS&quot; . $interfaceName . &quot;Constructor&quot;;
</ins><span class="cx"> 
</span><del>-                push(@implContent, &quot;void ${constructorFunctionName}(ExecState* exec, JSObject* thisObject, JSValue value)\n&quot;);
-                push(@implContent, &quot;{\n&quot;);
-                if ($interface-&gt;extendedAttributes-&gt;{&quot;CheckSecurity&quot;}) {
-                    if ($interfaceName eq &quot;DOMWindow&quot;) {
-                        push(@implContent, &quot;    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, jsCast&lt;$className*&gt;(thisObject)-&gt;impl()))\n&quot;);
-                    } else {
-                        push(@implContent, &quot;    if (!shouldAllowAccessToFrame(exec, jsCast&lt;$className*&gt;(thisObject)-&gt;impl().frame()))\n&quot;);
-                    }
-                    push(@implContent, &quot;        return;\n&quot;);
</del><ins>+            push(@implContent, &quot;void ${constructorFunctionName}(ExecState* exec, JSObject* thisObject, JSValue value)\n&quot;);
+            push(@implContent, &quot;{\n&quot;);
+            if ($interface-&gt;extendedAttributes-&gt;{&quot;CheckSecurity&quot;}) {
+                if ($interfaceName eq &quot;DOMWindow&quot;) {
+                    push(@implContent, &quot;    if (!BindingSecurity::shouldAllowAccessToDOMWindow(exec, jsCast&lt;$className*&gt;(thisObject)-&gt;impl()))\n&quot;);
+                } else {
+                    push(@implContent, &quot;    if (!shouldAllowAccessToFrame(exec, jsCast&lt;$className*&gt;(thisObject)-&gt;impl().frame()))\n&quot;);
</ins><span class="cx">                 }
</span><ins>+                push(@implContent, &quot;        return;\n&quot;);
+            }
</ins><span class="cx"> 
</span><del>-                push(@implContent, &quot;    // Shadowing a built-in constructor\n&quot;);
</del><ins>+            push(@implContent, &quot;    // Shadowing a built-in constructor\n&quot;);
</ins><span class="cx"> 
</span><del>-                if ($interfaceName eq &quot;DOMWindow&quot;) {
-                    push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().constructor, value);\n&quot;);
-                } else {
-                    die &quot;No way to handle interface with ReplaceableConstructor extended attribute: $interfaceName&quot;;
-                }
-                push(@implContent, &quot;}\n\n&quot;);
-            }        
</del><ins>+            if ($interfaceName eq &quot;DOMWindow&quot;) {
+                push(@implContent, &quot;    jsCast&lt;$className*&gt;(thisObject)-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().constructor, value);\n&quot;);
+            } else {
+                die &quot;No way to handle interface with ReplaceableConstructor extended attribute: $interfaceName&quot;;
+            }
+            push(@implContent, &quot;}\n\n&quot;);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>