<!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>[204978] 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/204978">204978</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2016-08-25 11:36:05 -0700 (Thu, 25 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add the ability to override the implementation name of IDL enums and dictionaries
https://bugs.webkit.org/show_bug.cgi?id=161185

Reviewed by Anders Carlsson.

* bindings/scripts/CodeGenerator.pm:
(ProcessDocument):
Build a dictionary of IDL name -&gt; implementation name overrides
for enums and dictionaries up front based on ImplementedAs extended
attribute.

(HasEnumImplementationNameOverride):
(GetEnumImplementationNameOverride):
(HasDictionaryImplementationNameOverride):
(GetDictionaryImplementationNameOverride):
Expose predicate and getter for name overrides.

* bindings/scripts/CodeGeneratorJS.pm:
(GetEnumerationClassName):
(GetDictionaryClassName):
Use the override names as necessary.

* bindings/scripts/test/TestObj.idl:
Add tests for enums and dictionaries with ImplementedAs extended
attributes.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204977 => 204978)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-25 18:23:54 UTC (rev 204977)
+++ trunk/Source/WebCore/ChangeLog        2016-08-25 18:36:05 UTC (rev 204978)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2016-08-24  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Add the ability to override the implementation name of IDL enums and dictionaries
+        https://bugs.webkit.org/show_bug.cgi?id=161185
+
+        Reviewed by Anders Carlsson.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (ProcessDocument):
+        Build a dictionary of IDL name -&gt; implementation name overrides
+        for enums and dictionaries up front based on ImplementedAs extended
+        attribute.
+
+        (HasEnumImplementationNameOverride):
+        (GetEnumImplementationNameOverride):
+        (HasDictionaryImplementationNameOverride):
+        (GetDictionaryImplementationNameOverride):
+        Expose predicate and getter for name overrides.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetEnumerationClassName):
+        (GetDictionaryClassName):
+        Use the override names as necessary.
+
+        * bindings/scripts/test/TestObj.idl:
+        Add tests for enums and dictionaries with ImplementedAs extended
+        attributes.
+
</ins><span class="cx"> 2016-08-25  Johan K. Jensen  &lt;johan_jensen@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Don't store networkLoadTiming in the disk cache
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (204977 => 204978)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-08-25 18:23:54 UTC (rev 204977)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-08-25 18:36:05 UTC (rev 204978)
</span><span class="lines">@@ -70,9 +70,13 @@
</span><span class="cx">     &quot;SerializedScriptValue&quot; =&gt; 1,
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-my %enumTypeHash = ();
</del><span class="cx"> my %dictionaryTypes = ();
</span><ins>+my %dictionaryTypeImplementationNameOverrides = ();
</ins><span class="cx"> 
</span><ins>+my %enumTypeHash = ();
+my %enumTypeImplementationNameOverrides = ();
+
+
</ins><span class="cx"> my %typedArrayTypes = (
</span><span class="cx">     &quot;ArrayBuffer&quot; =&gt; 1,
</span><span class="cx">     &quot;ArrayBufferView&quot; =&gt; 1,
</span><span class="lines">@@ -163,9 +167,20 @@
</span><span class="cx">     my $ifaceName = &quot;CodeGenerator&quot; . $useGenerator;
</span><span class="cx">     require $ifaceName . &quot;.pm&quot;;
</span><span class="cx"> 
</span><del>-    %enumTypeHash = map { $_-&gt;name =&gt; $_-&gt;values } @{$useDocument-&gt;enumerations};
-    %dictionaryTypes = map { $_-&gt;name =&gt; 1 } @{$useDocument-&gt;dictionaries};
</del><ins>+    foreach my $dictionary (@{$useDocument-&gt;dictionaries}) {
+        $dictionaryTypes{$dictionary-&gt;name} = 1;
+        if ($dictionary-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;}) {
+            $dictionaryTypeImplementationNameOverrides{$dictionary-&gt;name} = $dictionary-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;};
+        }
+    }
</ins><span class="cx"> 
</span><ins>+    foreach my $enumeration (@{$useDocument-&gt;enumerations}) {
+        $enumTypeHash{$enumeration-&gt;name} = $enumeration-&gt;values;
+        if ($enumeration-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;}) {
+            $enumTypeImplementationNameOverrides{$enumeration-&gt;name} = $enumeration-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;};
+        }
+    }
+
</ins><span class="cx">     # Dynamically load external code generation perl module
</span><span class="cx">     $codeGenerator = $ifaceName-&gt;new($object, $writeDependencies, $verbose, $targetIdlFilePath);
</span><span class="cx">     unless (defined($codeGenerator)) {
</span><span class="lines">@@ -395,8 +410,7 @@
</span><span class="cx"> # Currently used outside WebKit in an internal Apple project; can be removed soon.
</span><span class="cx"> sub IsStringType
</span><span class="cx"> {
</span><del>-    my $object = shift;
-    my $type = shift;
</del><ins>+    my ($object, $type) = @_;
</ins><span class="cx"> 
</span><span class="cx">     return 1 if $type eq &quot;DOMString&quot;;
</span><span class="cx">     return 1 if $type eq &quot;USVString&quot;;
</span><span class="lines">@@ -405,8 +419,7 @@
</span><span class="cx"> 
</span><span class="cx"> sub IsEnumType
</span><span class="cx"> {
</span><del>-    my $object = shift;
-    my $type = shift;
</del><ins>+    my ($object, $type) = @_;
</ins><span class="cx"> 
</span><span class="cx">     return 1 if exists $enumTypeHash{$type};
</span><span class="cx">     return 0;
</span><span class="lines">@@ -414,19 +427,49 @@
</span><span class="cx"> 
</span><span class="cx"> sub ValidEnumValues
</span><span class="cx"> {
</span><del>-    my $object = shift;
-    my $type = shift;
</del><ins>+    my ($object, $type) = @_;
</ins><span class="cx"> 
</span><span class="cx">     return @{$enumTypeHash{$type}};
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub HasEnumImplementationNameOverride
+{
+    my ($object, $type) = @_;
+
+    return 1 if exists $enumTypeImplementationNameOverrides{$type};
+    return 0;
+}
+
+sub GetEnumImplementationNameOverride
+{
+    my ($object, $type) = @_;
+
+    return $enumTypeImplementationNameOverrides{$type};
+}
+
</ins><span class="cx"> sub IsDictionaryType
</span><span class="cx"> {
</span><span class="cx">     my ($object, $type) = @_;
</span><span class="cx"> 
</span><del>-    return $dictionaryTypes{$type} || 0;
</del><ins>+    return 1 if exists $dictionaryTypes{$type};
+    return 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub HasDictionaryImplementationNameOverride
+{
+    my ($object, $type) = @_;
+
+    return 1 if exists $dictionaryTypeImplementationNameOverrides{$type};
+    return 0;
+}
+
+sub GetDictionaryImplementationNameOverride
+{
+    my ($object, $type) = @_;
+
+    return $dictionaryTypeImplementationNameOverrides{$type};
+}
+
</ins><span class="cx"> sub IsNonPointerType
</span><span class="cx"> {
</span><span class="cx">     my ($object, $type) = @_;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (204977 => 204978)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-08-25 18:23:54 UTC (rev 204977)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-08-25 18:36:05 UTC (rev 204978)
</span><span class="lines">@@ -807,6 +807,10 @@
</span><span class="cx"> {
</span><span class="cx">     my ($interface, $name) = @_;
</span><span class="cx"> 
</span><ins>+    if ($codeGenerator-&gt;HasEnumImplementationNameOverride($name)) {
+        return $codeGenerator-&gt;GetEnumImplementationNameOverride($name);
+    }
+
</ins><span class="cx">     return GetNestedClassName($interface, $name);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -922,6 +926,10 @@
</span><span class="cx"> {
</span><span class="cx">     my ($interface, $name) = @_;
</span><span class="cx"> 
</span><ins>+    if ($codeGenerator-&gt;HasDictionaryImplementationNameOverride($name)) {
+        return $codeGenerator-&gt;GetDictionaryImplementationNameOverride($name);
+    }
+
</ins><span class="cx">     return GetNestedClassName($interface, $name);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (204977 => 204978)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-08-25 18:23:54 UTC (rev 204977)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-08-25 18:36:05 UTC (rev 204978)
</span><span class="lines">@@ -194,6 +194,49 @@
</span><span class="cx">     return &quot;\&quot;\&quot;, \&quot;OptionalValue1\&quot;, \&quot;OptionalValue2\&quot;, \&quot;OptionalValue3\&quot;&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JSString* jsStringWithCache(ExecState*, AlternateEnumName);
+
+JSString* jsStringWithCache(ExecState* state, AlternateEnumName enumerationValue)
+{
+    static NeverDestroyed&lt;const String&gt; values[] = {
+        ASCIILiteral(&quot;enumValue1&quot;),
+        ASCIILiteral(&quot;EnumValue2&quot;),
+    };
+    static_assert(static_cast&lt;size_t&gt;(AlternateEnumName::EnumValue1) == 0, &quot;AlternateEnumName::EnumValue1 is not 0 as expected&quot;);
+    static_assert(static_cast&lt;size_t&gt;(AlternateEnumName::EnumValue2) == 1, &quot;AlternateEnumName::EnumValue2 is not 1 as expected&quot;);
+    ASSERT(static_cast&lt;size_t&gt;(enumerationValue) &lt; WTF_ARRAY_LENGTH(values));
+    return jsStringWithCache(state, values[static_cast&lt;size_t&gt;(enumerationValue)]);
+}
+
+template&lt;&gt; struct JSValueTraits&lt;AlternateEnumName&gt; {
+    static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, AlternateEnumName value) { return jsStringWithCache(state, value); }
+};
+
+template&lt;&gt; Optional&lt;AlternateEnumName&gt; parse&lt;AlternateEnumName&gt;(ExecState&amp; state, JSValue value)
+{
+    auto stringValue = value.toWTFString(&amp;state);
+    if (stringValue == &quot;enumValue1&quot;)
+        return AlternateEnumName::EnumValue1;
+    if (stringValue == &quot;EnumValue2&quot;)
+        return AlternateEnumName::EnumValue2;
+    return Nullopt;
+}
+
+template&lt;&gt; AlternateEnumName convert&lt;AlternateEnumName&gt;(ExecState&amp; state, JSValue value)
+{
+    auto result = parse&lt;AlternateEnumName&gt;(state, value);
+    if (UNLIKELY(!result)) {
+        throwTypeError(&amp;state);
+        return { };
+    }
+    return result.value();
+}
+
+template&lt;&gt; inline const char* expectedEnumerationValues&lt;AlternateEnumName&gt;()
+{
+    return &quot;\&quot;enumValue1\&quot;, \&quot;EnumValue2\&quot;&quot;;
+}
+
</ins><span class="cx"> #if ENABLE(Condition1)
</span><span class="cx"> 
</span><span class="cx"> JSString* jsStringWithCache(ExecState*, TestObj::EnumA);
</span><span class="lines">@@ -594,6 +637,22 @@
</span><span class="cx">     return TestObj::DictionaryThatShouldTolerateNull { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;&gt; Optional&lt;AlternateDictionaryName&gt; convertDictionary&lt;AlternateDictionaryName&gt;(ExecState&amp; state, JSValue value)
+{
+    if (value.isUndefinedOrNull())
+        return AlternateDictionaryName { { }, { } };
+    auto* object = value.getObject();
+    if (UNLIKELY(!object || object-&gt;type() == RegExpObjectType)) {
+        throwTypeError(&amp;state);
+        return Nullopt;
+    }
+    auto enumerationValue = convertOptional&lt;TestObj::EnumType&gt;(state, object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;enumerationValue&quot;)));
+    if (UNLIKELY(state.hadException()))
+        return Nullopt;
+    auto booleanWithoutDefault = convertOptional&lt;bool&gt;(state, object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;booleanWithoutDefault&quot;)));
+    return AlternateDictionaryName { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
+}
+
</ins><span class="cx"> // Functions
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TEST_FEATURE)
</span><span class="lines">@@ -774,6 +833,8 @@
</span><span class="cx"> bool setJSTestObjStringAttrTreatingNullAsEmptyString(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjUsvstringAttrTreatingNullAsEmptyString(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjUsvstringAttrTreatingNullAsEmptyString(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><ins>+JSC::EncodedJSValue jsTestObjImplementationEnumAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjImplementationEnumAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</ins><span class="cx"> JSC::EncodedJSValue jsTestObjXMLObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjXMLObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjCreate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="lines">@@ -1096,6 +1157,7 @@
</span><span class="cx">     { &quot;lenientTestObjAttr&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjLenientTestObjAttr), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjLenientTestObjAttr) } },
</span><span class="cx">     { &quot;stringAttrTreatingNullAsEmptyString&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjStringAttrTreatingNullAsEmptyString), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjStringAttrTreatingNullAsEmptyString) } },
</span><span class="cx">     { &quot;usvstringAttrTreatingNullAsEmptyString&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjUsvstringAttrTreatingNullAsEmptyString), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjUsvstringAttrTreatingNullAsEmptyString) } },
</span><ins>+    { &quot;implementationEnumAttr&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjImplementationEnumAttr), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjImplementationEnumAttr) } },
</ins><span class="cx">     { &quot;XMLObjAttr&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjXMLObjAttr), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjXMLObjAttr) } },
</span><span class="cx">     { &quot;create&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjCreate), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjCreate) } },
</span><span class="cx">     { &quot;reflectedStringAttr&quot;, CustomAccessor, NoIntrinsic, { (intptr_t)static_cast&lt;PropertySlot::GetValueFunc&gt;(jsTestObjReflectedStringAttr), (intptr_t) static_cast&lt;PutPropertySlot::PutValueFunc&gt;(setJSTestObjReflectedStringAttr) } },
</span><span class="lines">@@ -1784,6 +1846,21 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+EncodedJSValue jsTestObjImplementationEnumAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(thisValue);
+    JSValue decodedThisValue = JSValue::decode(thisValue);
+    auto* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(decodedThisValue);
+    if (UNLIKELY(!castedThis)) {
+        return throwGetterTypeError(*state, &quot;TestObject&quot;, &quot;implementationEnumAttr&quot;);
+    }
+    auto&amp; impl = castedThis-&gt;wrapped();
+    JSValue result = jsStringWithCache(state, impl.implementationEnumAttr());
+    return JSValue::encode(result);
+}
+
+
</ins><span class="cx"> EncodedJSValue jsTestObjXMLObjAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(state);
</span><span class="lines">@@ -3111,6 +3188,25 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+bool setJSTestObjImplementationEnumAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    JSValue value = JSValue::decode(encodedValue);
+    UNUSED_PARAM(thisValue);
+    JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(JSValue::decode(thisValue));
+    if (UNLIKELY(!castedThis)) {
+        return throwSetterTypeError(*state, &quot;TestObject&quot;, &quot;implementationEnumAttr&quot;);
+    }
+    auto&amp; impl = castedThis-&gt;wrapped();
+    auto nativeValue = parse&lt;AlternateEnumName&gt;(*state, value);
+    if (UNLIKELY(state-&gt;hadException()))
+        return false;
+    if (UNLIKELY(!nativeValue))
+        return false;
+    impl.setImplementationEnumAttr(nativeValue.value());
+    return true;
+}
+
+
</ins><span class="cx"> bool setJSTestObjXMLObjAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</span><span class="cx"> {
</span><span class="cx">     JSValue value = JSValue::decode(encodedValue);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (204977 => 204978)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-08-25 18:23:54 UTC (rev 204977)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-08-25 18:36:05 UTC (rev 204978)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 2009 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2010 Apple Inc. All rights reserved.
</span><span class="cx">  *
</span><del>- * Redistribution and use in source and binary formstrArg, with or without
</del><ins>+ * Redistribution and use in source and binary form, with or without
</ins><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="cx">  * are met:
</span><span class="cx">  *
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> // This IDL file is for testing the bindings code generator and for tracking
</span><del>-// changes in its ouput.
</del><ins>+// changes in its output.
</ins><span class="cx"> 
</span><span class="cx"> enum TestEnumType { &quot;&quot;, &quot;enumValue1&quot;, &quot;EnumValue2&quot;, &quot;EnumValue3&quot; };
</span><span class="cx"> 
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx"> // Leading underscore on an enum should be removed.
</span><span class="cx"> enum _optional { &quot;&quot;, &quot;OptionalValue1&quot;, &quot;OptionalValue2&quot;, &quot;OptionalValue3&quot; };
</span><span class="cx"> 
</span><ins>+[ImplementedAs=AlternateEnumName] enum TestEnumTypeWithAlternateImplementationName { &quot;enumValue1&quot;, &quot;EnumValue2&quot; };
+
</ins><span class="cx"> [Conditional=Condition1] enum TestEnumA { &quot;A&quot; };
</span><span class="cx"> [Conditional=Condition1&amp;Condition2] enum TestEnumB { &quot;B&quot; };
</span><span class="cx"> [Conditional=Condition1|Condition2] enum TestEnumC { &quot;C&quot; };
</span><span class="lines">@@ -79,6 +81,8 @@
</span><span class="cx">     [TreatNullAs=EmptyString] attribute USVString usvstringAttrTreatingNullAsEmptyString;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    attribute TestEnumTypeWithAlternateImplementationName implementationEnumAttr;
+
</ins><span class="cx">     // WK_ucfirst, WK_lcfirst exceptional cases.
</span><span class="cx">     attribute TestObj                  XMLObjAttr;
</span><span class="cx">     attribute boolean                  create;
</span><span class="lines">@@ -449,3 +453,10 @@
</span><span class="cx">     TestEnumType enumerationValue;
</span><span class="cx">     boolean booleanWithoutDefault;
</span><span class="cx"> };
</span><ins>+
+[
+    ImplementedAs=AlternateDictionaryName
+] dictionary TestDictionaryWithAlternateImplementationName {
+    TestEnumType enumerationValue;
+    boolean booleanWithoutDefault;
+};
</ins></span></pre>
</div>
</div>

</body>
</html>