<!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 -> 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 <sam@webkit.org>
+
+ 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 -> 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 <johan_jensen@apple.com>
</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"> "SerializedScriptValue" => 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"> "ArrayBuffer" => 1,
</span><span class="cx"> "ArrayBufferView" => 1,
</span><span class="lines">@@ -163,9 +167,20 @@
</span><span class="cx"> my $ifaceName = "CodeGenerator" . $useGenerator;
</span><span class="cx"> require $ifaceName . ".pm";
</span><span class="cx">
</span><del>- %enumTypeHash = map { $_->name => $_->values } @{$useDocument->enumerations};
- %dictionaryTypes = map { $_->name => 1 } @{$useDocument->dictionaries};
</del><ins>+ foreach my $dictionary (@{$useDocument->dictionaries}) {
+ $dictionaryTypes{$dictionary->name} = 1;
+ if ($dictionary->extendedAttributes->{"ImplementedAs"}) {
+ $dictionaryTypeImplementationNameOverrides{$dictionary->name} = $dictionary->extendedAttributes->{"ImplementedAs"};
+ }
+ }
</ins><span class="cx">
</span><ins>+ foreach my $enumeration (@{$useDocument->enumerations}) {
+ $enumTypeHash{$enumeration->name} = $enumeration->values;
+ if ($enumeration->extendedAttributes->{"ImplementedAs"}) {
+ $enumTypeImplementationNameOverrides{$enumeration->name} = $enumeration->extendedAttributes->{"ImplementedAs"};
+ }
+ }
+
</ins><span class="cx"> # Dynamically load external code generation perl module
</span><span class="cx"> $codeGenerator = $ifaceName->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 "DOMString";
</span><span class="cx"> return 1 if $type eq "USVString";
</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->HasEnumImplementationNameOverride($name)) {
+ return $codeGenerator->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->HasDictionaryImplementationNameOverride($name)) {
+ return $codeGenerator->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 "\"\", \"OptionalValue1\", \"OptionalValue2\", \"OptionalValue3\"";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSString* jsStringWithCache(ExecState*, AlternateEnumName);
+
+JSString* jsStringWithCache(ExecState* state, AlternateEnumName enumerationValue)
+{
+ static NeverDestroyed<const String> values[] = {
+ ASCIILiteral("enumValue1"),
+ ASCIILiteral("EnumValue2"),
+ };
+ static_assert(static_cast<size_t>(AlternateEnumName::EnumValue1) == 0, "AlternateEnumName::EnumValue1 is not 0 as expected");
+ static_assert(static_cast<size_t>(AlternateEnumName::EnumValue2) == 1, "AlternateEnumName::EnumValue2 is not 1 as expected");
+ ASSERT(static_cast<size_t>(enumerationValue) < WTF_ARRAY_LENGTH(values));
+ return jsStringWithCache(state, values[static_cast<size_t>(enumerationValue)]);
+}
+
+template<> struct JSValueTraits<AlternateEnumName> {
+ static JSString* arrayJSValue(ExecState* state, JSDOMGlobalObject*, AlternateEnumName value) { return jsStringWithCache(state, value); }
+};
+
+template<> Optional<AlternateEnumName> parse<AlternateEnumName>(ExecState& state, JSValue value)
+{
+ auto stringValue = value.toWTFString(&state);
+ if (stringValue == "enumValue1")
+ return AlternateEnumName::EnumValue1;
+ if (stringValue == "EnumValue2")
+ return AlternateEnumName::EnumValue2;
+ return Nullopt;
+}
+
+template<> AlternateEnumName convert<AlternateEnumName>(ExecState& state, JSValue value)
+{
+ auto result = parse<AlternateEnumName>(state, value);
+ if (UNLIKELY(!result)) {
+ throwTypeError(&state);
+ return { };
+ }
+ return result.value();
+}
+
+template<> inline const char* expectedEnumerationValues<AlternateEnumName>()
+{
+ return "\"enumValue1\", \"EnumValue2\"";
+}
+
</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<> Optional<AlternateDictionaryName> convertDictionary<AlternateDictionaryName>(ExecState& state, JSValue value)
+{
+ if (value.isUndefinedOrNull())
+ return AlternateDictionaryName { { }, { } };
+ auto* object = value.getObject();
+ if (UNLIKELY(!object || object->type() == RegExpObjectType)) {
+ throwTypeError(&state);
+ return Nullopt;
+ }
+ auto enumerationValue = convertOptional<TestObj::EnumType>(state, object->get(&state, Identifier::fromString(&state, "enumerationValue")));
+ if (UNLIKELY(state.hadException()))
+ return Nullopt;
+ auto booleanWithoutDefault = convertOptional<bool>(state, object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault")));
+ 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"> { "lenientTestObjAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLenientTestObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjLenientTestObjAttr) } },
</span><span class="cx"> { "stringAttrTreatingNullAsEmptyString", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttrTreatingNullAsEmptyString), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjStringAttrTreatingNullAsEmptyString) } },
</span><span class="cx"> { "usvstringAttrTreatingNullAsEmptyString", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUsvstringAttrTreatingNullAsEmptyString), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjUsvstringAttrTreatingNullAsEmptyString) } },
</span><ins>+ { "implementationEnumAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjImplementationEnumAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjImplementationEnumAttr) } },
</ins><span class="cx"> { "XMLObjAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjXMLObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjXMLObjAttr) } },
</span><span class="cx"> { "create", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCreate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjCreate) } },
</span><span class="cx"> { "reflectedStringAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(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<JSTestObj*>(decodedThisValue);
+ if (UNLIKELY(!castedThis)) {
+ return throwGetterTypeError(*state, "TestObject", "implementationEnumAttr");
+ }
+ auto& impl = castedThis->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<JSTestObj*>(JSValue::decode(thisValue));
+ if (UNLIKELY(!castedThis)) {
+ return throwSetterTypeError(*state, "TestObject", "implementationEnumAttr");
+ }
+ auto& impl = castedThis->wrapped();
+ auto nativeValue = parse<AlternateEnumName>(*state, value);
+ if (UNLIKELY(state->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 { "", "enumValue1", "EnumValue2", "EnumValue3" };
</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 { "", "OptionalValue1", "OptionalValue2", "OptionalValue3" };
</span><span class="cx">
</span><ins>+[ImplementedAs=AlternateEnumName] enum TestEnumTypeWithAlternateImplementationName { "enumValue1", "EnumValue2" };
+
</ins><span class="cx"> [Conditional=Condition1] enum TestEnumA { "A" };
</span><span class="cx"> [Conditional=Condition1&Condition2] enum TestEnumB { "B" };
</span><span class="cx"> [Conditional=Condition1|Condition2] enum TestEnumC { "C" };
</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>