<!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>[206776] 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/206776">206776</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-10-04 11:51:44 -0700 (Tue, 04 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Web IDL] Add support for dictionary inheritance
https://bugs.webkit.org/show_bug.cgi?id=162907
Reviewed by Sam Weinig.
Add support for dictionary inheritance to our Web IDL parser and
bindings generator. Leverage this new support for EventTarget's
EventListenerOptions / AddEventListenerOptions dictionaries, in
order to match the DOM specification:
- https://dom.spec.whatwg.org/#interface-eventtarget
Also update the bindings generator to convert the dictionary
members in lexicographical order, as per:
- https://heycam.github.io/webidl/#es-dictionary (Step 5.1)
No new tests, rebaselined bindings tests.
* bindings/scripts/CodeGenerator.pm:
(GetDictionaryByName):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent):
* bindings/scripts/IDLParser.pm:
(parseDictionary):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convertDictionary<TestObj::Dictionary>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
(WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
(WebCore::convertDictionary<AlternateDictionaryName>):
(WebCore::convertDictionary<TestObj::ParentDictionary>):
(WebCore::convertDictionary<TestObj::ChildDictionary>):
* bindings/scripts/test/TestObj.idl:
* dom/EventTarget.idl:</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="#trunkSourceWebCorebindingsscriptsIDLParserpm">trunk/Source/WebCore/bindings/scripts/IDLParser.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>
<li><a href="#trunkSourceWebCoredomEventTargetidl">trunk/Source/WebCore/dom/EventTarget.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206775 => 206776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-04 18:45:20 UTC (rev 206775)
+++ trunk/Source/WebCore/ChangeLog        2016-10-04 18:51:44 UTC (rev 206776)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2016-10-04 Chris Dumez <cdumez@apple.com>
+
+ [Web IDL] Add support for dictionary inheritance
+ https://bugs.webkit.org/show_bug.cgi?id=162907
+
+ Reviewed by Sam Weinig.
+
+ Add support for dictionary inheritance to our Web IDL parser and
+ bindings generator. Leverage this new support for EventTarget's
+ EventListenerOptions / AddEventListenerOptions dictionaries, in
+ order to match the DOM specification:
+ - https://dom.spec.whatwg.org/#interface-eventtarget
+
+ Also update the bindings generator to convert the dictionary
+ members in lexicographical order, as per:
+ - https://heycam.github.io/webidl/#es-dictionary (Step 5.1)
+
+ No new tests, rebaselined bindings tests.
+
+ * bindings/scripts/CodeGenerator.pm:
+ (GetDictionaryByName):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateDictionaryImplementationContent):
+ * bindings/scripts/IDLParser.pm:
+ (parseDictionary):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::convertDictionary<TestObj::Dictionary>):
+ (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
+ (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
+ (WebCore::convertDictionary<AlternateDictionaryName>):
+ (WebCore::convertDictionary<TestObj::ParentDictionary>):
+ (WebCore::convertDictionary<TestObj::ChildDictionary>):
+ * bindings/scripts/test/TestObj.idl:
+ * dom/EventTarget.idl:
+
</ins><span class="cx"> 2016-10-04 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [Win][Direct2D] Add initial D2D GraphicsContext implementation
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (206775 => 206776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-10-04 18:45:20 UTC (rev 206775)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-10-04 18:51:44 UTC (rev 206776)
</span><span class="lines">@@ -455,6 +455,16 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub GetDictionaryByName
+{
+ my ($object, $name) = @_;
+ return unless defined($name);
+
+ for my $dictionary (@{$useDocument->dictionaries}) {
+ return $dictionary if $dictionary->name eq $name;
+ }
+}
+
</ins><span class="cx"> sub HasDictionaryImplementationNameOverride
</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 (206775 => 206776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-04 18:45:20 UTC (rev 206775)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-04 18:51:44 UTC (rev 206776)
</span><span class="lines">@@ -953,10 +953,10 @@
</span><span class="cx">
</span><span class="cx"> sub GenerateDictionaryImplementationContent
</span><span class="cx"> {
</span><del>- my ($interface, $dictionaries) = @_;
</del><ins>+ my ($interface, $allDictionaries) = @_;
</ins><span class="cx">
</span><span class="cx"> my $result = "";
</span><del>- foreach my $dictionary (@$dictionaries) {
</del><ins>+ foreach my $dictionary (@$allDictionaries) {
</ins><span class="cx"> my $name = $dictionary->name;
</span><span class="cx">
</span><span class="cx"> my $conditionalString = $codeGenerator->GenerateConditionalString($dictionary);
</span><span class="lines">@@ -988,79 +988,90 @@
</span><span class="cx"> $result .= " }\n";
</span><span class="cx">
</span><span class="cx"> # 3. Let dict be an empty dictionary value of type D; every dictionary member is initially considered to be not present.
</span><ins>+
</ins><span class="cx"> # 4. Let dictionaries be a list consisting of D and all of D’s inherited dictionaries, in order from least to most derived.
</span><del>- # FIXME: We do not support dictionary inheritence yet.
</del><ins>+ my @dictionaries;
+ push(@dictionaries, $dictionary);
+ my $parentDictionary = $codeGenerator->GetDictionaryByName($dictionary->parent);
+ while (defined($parentDictionary)) {
+ unshift(@dictionaries, $parentDictionary);
+ $parentDictionary = $codeGenerator->GetDictionaryByName($parentDictionary->parent);
+ }
</ins><span class="cx">
</span><ins>+ my $arguments = "";
+ my $comma = "";
+
</ins><span class="cx"> # 5. For each dictionary dictionary in dictionaries, in order:
</span><del>- foreach my $member (@{$dictionary->members}) {
- $member->default("undefined") if $member->type eq "any"; # Use undefined as default value for member of type 'any'.
</del><ins>+ foreach my $dictionary (@dictionaries) {
+ # For each dictionary member member declared on dictionary, in lexicographical order:
+ my @sortedMembers = sort { $a->name cmp $b->name } @{$dictionary->members};
+ foreach my $member (@sortedMembers) {
+ $member->default("undefined") if $member->type eq "any"; # Use undefined as default value for member of type 'any'.
</ins><span class="cx">
</span><del>- my $type = $member->type;
</del><ins>+ my $type = $member->type;
</ins><span class="cx">
</span><del>- # 5.1. Let key be the identifier of member.
- my $key = $member->name;
</del><ins>+ # 5.1. Let key be the identifier of member.
+ my $key = $member->name;
</ins><span class="cx">
</span><del>- # 5.2. Let value be an ECMAScript value, depending on Type(V):
- $result .= " JSValue ${key}Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, \"${key}\"));\n";
</del><ins>+ # 5.2. Let value be an ECMAScript value, depending on Type(V):
+ $result .= " JSValue ${key}Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, \"${key}\"));\n";
</ins><span class="cx">
</span><del>- my $nativeType = GetNativeTypeFromSignature($interface, $member);
- if ($member->isOptional && !defined $member->default) {
- $result .= " Converter<$nativeType>::OptionalValue $key;\n";
- } else {
- $result .= " $nativeType $key;\n";
- }
</del><ins>+ my $nativeType = GetNativeTypeFromSignature($interface, $member);
+ if ($member->isOptional && !defined $member->default) {
+ $result .= " Converter<$nativeType>::OptionalValue $key;\n";
+ } else {
+ $result .= " $nativeType $key;\n";
+ }
</ins><span class="cx">
</span><del>- # 5.3. If value is not undefined, then:
- $result .= " if (!${key}Value.isUndefined()) {\n";
- # FIXME: Eventually we will want this to share a lot more code with JSValueToNative.
- if ($codeGenerator->IsWrapperType($type)) {
- AddToImplIncludes("JS${type}.h");
- die "Dictionary members of non-nullable wrapper types must be marked as required" if !$member->isNullable && $member->isOptional;
- my $nullableParameter = $member->isNullable ? "IsNullable::Yes" : "IsNullable::No";
- $result .= " $key = convertWrapperType<$type, JS${type}>(state, ${key}Value, $nullableParameter);\n";
- } elsif ($codeGenerator->IsDictionaryType($type)) {
- my $nativeType = GetNativeType($interface, $type);
- $result .= " $key = convertDictionary<${nativeType}>(state, ${key}Value);\n";
- } else {
- my $conversionRuleWithLeadingComma = GenerateConversionRuleWithLeadingComma($interface, $member);
- $result .= " $key = convert<${nativeType}>(state, ${key}Value${conversionRuleWithLeadingComma});\n";
</del><ins>+ # 5.3. If value is not undefined, then:
+ $result .= " if (!${key}Value.isUndefined()) {\n";
+ # FIXME: Eventually we will want this to share a lot more code with JSValueToNative.
+ if ($codeGenerator->IsWrapperType($type)) {
+ AddToImplIncludes("JS${type}.h");
+ die "Dictionary members of non-nullable wrapper types must be marked as required" if !$member->isNullable && $member->isOptional;
+ my $nullableParameter = $member->isNullable ? "IsNullable::Yes" : "IsNullable::No";
+ $result .= " $key = convertWrapperType<$type, JS${type}>(state, ${key}Value, $nullableParameter);\n";
+ } elsif ($codeGenerator->IsDictionaryType($type)) {
+ my $nativeType = GetNativeType($interface, $type);
+ $result .= " $key = convertDictionary<${nativeType}>(state, ${key}Value);\n";
+ } else {
+ my $conversionRuleWithLeadingComma = GenerateConversionRuleWithLeadingComma($interface, $member);
+ $result .= " $key = convert<${nativeType}>(state, ${key}Value${conversionRuleWithLeadingComma});\n";
+ }
+ $result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n";
+ # Value is undefined.
+ # 5.4. Otherwise, if value is undefined but the dictionary member has a default value, then:
+ if ($member->isOptional && defined $member->default) {
+ $result .= " } else\n";
+ $result .= " $key = " . GenerateDefaultValue($interface, $member) . ";\n";
+ } elsif (!$member->isOptional) {
+ # 5.5. Otherwise, if value is undefined and the dictionary member is a required dictionary member, then throw a TypeError.
+ $result .= " } else {\n";
+ $result .= " throwTypeError(&state, throwScope);\n";
+ $result .= " return Nullopt;\n";
+ $result .= " }\n";
+ } else {
+ $result .= " }\n";
+ }
</ins><span class="cx"> }
</span><del>- $result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n";
- # Value is undefined.
- # 5.4. Otherwise, if value is undefined but the dictionary member has a default value, then:
- if ($member->isOptional && defined $member->default) {
- $result .= " } else\n";
- $result .= " $key = " . GenerateDefaultValue($interface, $member) . ";\n";
- } elsif (!$member->isOptional) {
- # 5.5. Otherwise, if value is undefined and the dictionary member is a required dictionary member, then throw a TypeError.
- $result .= " } else {\n";
- $result .= " throwTypeError(&state, throwScope);\n";
- $result .= " return Nullopt;\n";
- $result .= " }\n";
- } else {
- $result .= " }\n";
- }
- }
</del><span class="cx">
</span><del>- # 6. Return dict.
- my $arguments = "";
- my $comma = "";
- foreach my $member (@{$dictionary->members}) {
- my $value;
- if ($codeGenerator->IsWrapperType($member->type) && !$member->isNullable) {
- $value = "*" . $member->name;
- } elsif ($codeGenerator->IsDictionaryType($member->type)) {
- $value = $member->name . ".value()";
- } else {
- $value = "WTFMove(" . $member->name . ")";
</del><ins>+ # 6. Return dict.
+ foreach my $member (@{$dictionary->members}) {
+ my $value;
+ if ($codeGenerator->IsWrapperType($member->type) && !$member->isNullable) {
+ $value = "*" . $member->name;
+ } elsif ($codeGenerator->IsDictionaryType($member->type)) {
+ $value = $member->name . ".value()";
+ } else {
+ $value = "WTFMove(" . $member->name . ")";
+ }
+ $arguments .= $comma . $value;
+ $comma = ", ";
</ins><span class="cx"> }
</span><del>- $arguments .= $comma . $value;
- $comma = ", ";
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $result .= " return $className { " . $arguments . " };\n";
</span><span class="cx"> $result .= "}\n\n";
</span><del>-
</del><span class="cx"> $result .= "#endif\n\n" if $conditionalString;
</span><span class="cx"> }
</span><span class="cx"> return $result;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLParserpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (206775 => 206776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm        2016-10-04 18:45:20 UTC (rev 206775)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm        2016-10-04 18:51:44 UTC (rev 206776)
</span><span class="lines">@@ -130,6 +130,7 @@
</span><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> struct( domDictionary => {
</span><ins>+ parent => '$', # Parent class identifier
</ins><span class="cx"> name => '$',
</span><span class="cx"> members => '@', # List of 'domSignature'
</span><span class="cx"> extendedAttributes => '$',
</span><span class="lines">@@ -659,7 +660,8 @@
</span><span class="cx"> my $nameToken = $self->getToken();
</span><span class="cx"> $self->assertTokenType($nameToken, IdentifierToken);
</span><span class="cx"> $dictionary->name($nameToken->value());
</span><del>- $self->parseInheritance();
</del><ins>+ my $parents = $self->parseInheritance();
+ $dictionary->parent($parents->[0]);
</ins><span class="cx"> $self->assertTokenValue($self->getToken(), "{", __LINE__);
</span><span class="cx"> $dictionary->members($self->parseDictionaryMembers());
</span><span class="cx"> $self->assertTokenValue($self->getToken(), "}", __LINE__);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (206775 => 206776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-10-04 18:45:20 UTC (rev 206775)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-10-04 18:51:44 UTC (rev 206776)
</span><span class="lines">@@ -530,12 +530,39 @@
</span><span class="cx"> throwTypeError(&state, throwScope);
</span><span class="cx"> return Nullopt;
</span><span class="cx"> }
</span><del>- JSValue enumerationValueWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithoutDefault"));
- Converter<TestObj::EnumType>::OptionalValue enumerationValueWithoutDefault;
- if (!enumerationValueWithoutDefaultValue.isUndefined()) {
- enumerationValueWithoutDefault = convert<TestObj::EnumType>(state, enumerationValueWithoutDefaultValue);
</del><ins>+ JSValue anyTypedefValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyTypedefValue"));
+ JSC::JSValue anyTypedefValue;
+ if (!anyTypedefValueValue.isUndefined()) {
+ anyTypedefValue = convert<JSC::JSValue>(state, anyTypedefValueValue);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><ins>+ } else
+ anyTypedefValue = jsUndefined();
+ JSValue anyValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyValue"));
+ JSC::JSValue anyValue;
+ if (!anyValueValue.isUndefined()) {
+ anyValue = convert<JSC::JSValue>(state, anyValueValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ anyValue = jsUndefined();
+ JSValue booleanWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithDefault"));
+ bool booleanWithDefault;
+ if (!booleanWithDefaultValue.isUndefined()) {
+ booleanWithDefault = convert<bool>(state, booleanWithDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ booleanWithDefault = false;
+ JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
+ Converter<bool>::OptionalValue booleanWithoutDefault;
+ if (!booleanWithoutDefaultValue.isUndefined()) {
+ booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
</ins><span class="cx"> }
</span><ins>+ JSValue dictionaryMemberValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "dictionaryMember"));
+ Converter<TestObj::DictionaryThatShouldTolerateNull>::OptionalValue dictionaryMember;
+ if (!dictionaryMemberValue.isUndefined()) {
+ dictionaryMember = convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(state, dictionaryMemberValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
</ins><span class="cx"> JSValue enumerationValueWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithDefault"));
</span><span class="cx"> TestObj::EnumType enumerationValueWithDefault;
</span><span class="cx"> if (!enumerationValueWithDefaultValue.isUndefined()) {
</span><span class="lines">@@ -550,38 +577,45 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> } else
</span><span class="cx"> enumerationValueWithEmptyStringDefault = TestObj::EnumType::EmptyString;
</span><del>- JSValue stringWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "stringWithDefault"));
- String stringWithDefault;
- if (!stringWithDefaultValue.isUndefined()) {
- stringWithDefault = convert<String>(state, stringWithDefaultValue);
</del><ins>+ JSValue enumerationValueWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValueWithoutDefault"));
+ Converter<TestObj::EnumType>::OptionalValue enumerationValueWithoutDefault;
+ if (!enumerationValueWithoutDefaultValue.isUndefined()) {
+ enumerationValueWithoutDefault = convert<TestObj::EnumType>(state, enumerationValueWithoutDefaultValue);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><del>- } else
- stringWithDefault = "defaultString";
- JSValue stringWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "stringWithoutDefault"));
- Converter<String>::OptionalValue stringWithoutDefault;
- if (!stringWithoutDefaultValue.isUndefined()) {
- stringWithoutDefault = convert<String>(state, stringWithoutDefaultValue);
</del><ins>+ }
+ JSValue integerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "integer"));
+ Converter<int32_t>::OptionalValue integer;
+ if (!integerValue.isUndefined()) {
+ integer = convert<int32_t>(state, integerValue, NormalConversion);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> }
</span><del>- JSValue booleanWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithDefault"));
- bool booleanWithDefault;
- if (!booleanWithDefaultValue.isUndefined()) {
- booleanWithDefault = convert<bool>(state, booleanWithDefaultValue);
</del><ins>+ JSValue integerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "integerWithDefault"));
+ int32_t integerWithDefault;
+ if (!integerWithDefaultValue.isUndefined()) {
+ integerWithDefault = convert<int32_t>(state, integerWithDefaultValue, NormalConversion);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> } else
</span><del>- booleanWithDefault = false;
- JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
- Converter<bool>::OptionalValue booleanWithoutDefault;
- if (!booleanWithoutDefaultValue.isUndefined()) {
- booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
</del><ins>+ integerWithDefault = 0;
+ JSValue largeIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "largeInteger"));
+ Converter<int64_t>::OptionalValue largeInteger;
+ if (!largeIntegerValue.isUndefined()) {
+ largeInteger = convert<int64_t>(state, largeIntegerValue, NormalConversion);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> }
</span><del>- JSValue sequenceOfStringsValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "sequenceOfStrings"));
- Converter<Vector<String>>::OptionalValue sequenceOfStrings;
- if (!sequenceOfStringsValue.isUndefined()) {
- sequenceOfStrings = convert<Vector<String>>(state, sequenceOfStringsValue);
</del><ins>+ JSValue largeIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "largeIntegerWithDefault"));
+ int64_t largeIntegerWithDefault;
+ if (!largeIntegerWithDefaultValue.isUndefined()) {
+ largeIntegerWithDefault = convert<int64_t>(state, largeIntegerWithDefaultValue, NormalConversion);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><del>- }
</del><ins>+ } else
+ largeIntegerWithDefault = 0;
+ JSValue nullableNodeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableNode"));
+ Node* nullableNode;
+ if (!nullableNodeValue.isUndefined()) {
+ nullableNode = convertWrapperType<Node, JSNode>(state, nullableNodeValue, IsNullable::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ nullableNode = nullptr;
</ins><span class="cx"> JSValue restrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedDouble"));
</span><span class="cx"> Converter<double>::OptionalValue restrictedDouble;
</span><span class="cx"> if (!restrictedDoubleValue.isUndefined()) {
</span><span class="lines">@@ -588,12 +622,6 @@
</span><span class="cx"> restrictedDouble = convert<double>(state, restrictedDoubleValue, ShouldAllowNonFinite::No);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> }
</span><del>- JSValue unrestrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedDouble"));
- Converter<double>::OptionalValue unrestrictedDouble;
- if (!unrestrictedDoubleValue.isUndefined()) {
- unrestrictedDouble = convert<double>(state, unrestrictedDoubleValue, ShouldAllowNonFinite::Yes);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- }
</del><span class="cx"> JSValue restrictedDoubleWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedDoubleWithDefault"));
</span><span class="cx"> double restrictedDoubleWithDefault;
</span><span class="cx"> if (!restrictedDoubleWithDefaultValue.isUndefined()) {
</span><span class="lines">@@ -601,13 +629,6 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> } else
</span><span class="cx"> restrictedDoubleWithDefault = 0;
</span><del>- JSValue unrestrictedDoubleWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedDoubleWithDefault"));
- double unrestrictedDoubleWithDefault;
- if (!unrestrictedDoubleWithDefaultValue.isUndefined()) {
- unrestrictedDoubleWithDefault = convert<double>(state, unrestrictedDoubleWithDefaultValue, ShouldAllowNonFinite::Yes);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- } else
- unrestrictedDoubleWithDefault = 0;
</del><span class="cx"> JSValue restrictedFloatValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedFloat"));
</span><span class="cx"> Converter<float>::OptionalValue restrictedFloat;
</span><span class="cx"> if (!restrictedFloatValue.isUndefined()) {
</span><span class="lines">@@ -614,12 +635,6 @@
</span><span class="cx"> restrictedFloat = convert<float>(state, restrictedFloatValue, ShouldAllowNonFinite::No);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> }
</span><del>- JSValue unrestrictedFloatValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedFloat"));
- Converter<float>::OptionalValue unrestrictedFloat;
- if (!unrestrictedFloatValue.isUndefined()) {
- unrestrictedFloat = convert<float>(state, unrestrictedFloatValue, ShouldAllowNonFinite::Yes);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- }
</del><span class="cx"> JSValue restrictedFloatWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "restrictedFloatWithDefault"));
</span><span class="cx"> float restrictedFloatWithDefault;
</span><span class="cx"> if (!restrictedFloatWithDefaultValue.isUndefined()) {
</span><span class="lines">@@ -627,13 +642,12 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> } else
</span><span class="cx"> restrictedFloatWithDefault = 0;
</span><del>- JSValue unrestrictedFloatWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedFloatWithDefault"));
- float unrestrictedFloatWithDefault;
- if (!unrestrictedFloatWithDefaultValue.isUndefined()) {
- unrestrictedFloatWithDefault = convert<float>(state, unrestrictedFloatWithDefaultValue, ShouldAllowNonFinite::Yes);
</del><ins>+ JSValue sequenceOfStringsValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "sequenceOfStrings"));
+ Converter<Vector<String>>::OptionalValue sequenceOfStrings;
+ if (!sequenceOfStringsValue.isUndefined()) {
+ sequenceOfStrings = convert<Vector<String>>(state, sequenceOfStringsValue);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><del>- } else
- unrestrictedFloatWithDefault = 0;
</del><ins>+ }
</ins><span class="cx"> JSValue smallIntegerClampedValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "smallIntegerClamped"));
</span><span class="cx"> Converter<int8_t>::OptionalValue smallIntegerClamped;
</span><span class="cx"> if (!smallIntegerClampedValue.isUndefined()) {
</span><span class="lines">@@ -659,19 +673,45 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> } else
</span><span class="cx"> smallUnsignedIntegerWithDefault = 0;
</span><del>- JSValue integerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "integer"));
- Converter<int32_t>::OptionalValue integer;
- if (!integerValue.isUndefined()) {
- integer = convert<int32_t>(state, integerValue, NormalConversion);
</del><ins>+ JSValue stringWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "stringWithDefault"));
+ String stringWithDefault;
+ if (!stringWithDefaultValue.isUndefined()) {
+ stringWithDefault = convert<String>(state, stringWithDefaultValue);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><ins>+ } else
+ stringWithDefault = "defaultString";
+ JSValue stringWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "stringWithoutDefault"));
+ Converter<String>::OptionalValue stringWithoutDefault;
+ if (!stringWithoutDefaultValue.isUndefined()) {
+ stringWithoutDefault = convert<String>(state, stringWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
</ins><span class="cx"> }
</span><del>- JSValue integerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "integerWithDefault"));
- int32_t integerWithDefault;
- if (!integerWithDefaultValue.isUndefined()) {
- integerWithDefault = convert<int32_t>(state, integerWithDefaultValue, NormalConversion);
</del><ins>+ JSValue unrestrictedDoubleValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedDouble"));
+ Converter<double>::OptionalValue unrestrictedDouble;
+ if (!unrestrictedDoubleValue.isUndefined()) {
+ unrestrictedDouble = convert<double>(state, unrestrictedDoubleValue, ShouldAllowNonFinite::Yes);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><ins>+ }
+ JSValue unrestrictedDoubleWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedDoubleWithDefault"));
+ double unrestrictedDoubleWithDefault;
+ if (!unrestrictedDoubleWithDefaultValue.isUndefined()) {
+ unrestrictedDoubleWithDefault = convert<double>(state, unrestrictedDoubleWithDefaultValue, ShouldAllowNonFinite::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
</ins><span class="cx"> } else
</span><del>- integerWithDefault = 0;
</del><ins>+ unrestrictedDoubleWithDefault = 0;
+ JSValue unrestrictedFloatValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedFloat"));
+ Converter<float>::OptionalValue unrestrictedFloat;
+ if (!unrestrictedFloatValue.isUndefined()) {
+ unrestrictedFloat = convert<float>(state, unrestrictedFloatValue, ShouldAllowNonFinite::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue unrestrictedFloatWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unrestrictedFloatWithDefault"));
+ float unrestrictedFloatWithDefault;
+ if (!unrestrictedFloatWithDefaultValue.isUndefined()) {
+ unrestrictedFloatWithDefault = convert<float>(state, unrestrictedFloatWithDefaultValue, ShouldAllowNonFinite::Yes);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else
+ unrestrictedFloatWithDefault = 0;
</ins><span class="cx"> JSValue unsignedIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedInteger"));
</span><span class="cx"> Converter<uint32_t>::OptionalValue unsignedInteger;
</span><span class="cx"> if (!unsignedIntegerValue.isUndefined()) {
</span><span class="lines">@@ -685,19 +725,6 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> } else
</span><span class="cx"> unsignedIntegerWithDefault = 0;
</span><del>- JSValue largeIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "largeInteger"));
- Converter<int64_t>::OptionalValue largeInteger;
- if (!largeIntegerValue.isUndefined()) {
- largeInteger = convert<int64_t>(state, largeIntegerValue, NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- }
- JSValue largeIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "largeIntegerWithDefault"));
- int64_t largeIntegerWithDefault;
- if (!largeIntegerWithDefaultValue.isUndefined()) {
- largeIntegerWithDefault = convert<int64_t>(state, largeIntegerWithDefaultValue, NormalConversion);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- } else
- largeIntegerWithDefault = 0;
</del><span class="cx"> JSValue unsignedLargeIntegerValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "unsignedLargeInteger"));
</span><span class="cx"> Converter<uint64_t>::OptionalValue unsignedLargeInteger;
</span><span class="cx"> if (!unsignedLargeIntegerValue.isUndefined()) {
</span><span class="lines">@@ -711,33 +738,6 @@
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> } else
</span><span class="cx"> unsignedLargeIntegerWithDefault = 0;
</span><del>- JSValue nullableNodeValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "nullableNode"));
- Node* nullableNode;
- if (!nullableNodeValue.isUndefined()) {
- nullableNode = convertWrapperType<Node, JSNode>(state, nullableNodeValue, IsNullable::Yes);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- } else
- nullableNode = nullptr;
- JSValue anyValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyValue"));
- JSC::JSValue anyValue;
- if (!anyValueValue.isUndefined()) {
- anyValue = convert<JSC::JSValue>(state, anyValueValue);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- } else
- anyValue = jsUndefined();
- JSValue anyTypedefValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "anyTypedefValue"));
- JSC::JSValue anyTypedefValue;
- if (!anyTypedefValueValue.isUndefined()) {
- anyTypedefValue = convert<JSC::JSValue>(state, anyTypedefValueValue);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- } else
- anyTypedefValue = jsUndefined();
- JSValue dictionaryMemberValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "dictionaryMember"));
- Converter<TestObj::DictionaryThatShouldTolerateNull>::OptionalValue dictionaryMember;
- if (!dictionaryMemberValue.isUndefined()) {
- dictionaryMember = convertDictionary<TestObj::DictionaryThatShouldTolerateNull>(state, dictionaryMemberValue);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- }
</del><span class="cx"> return TestObj::Dictionary { WTFMove(enumerationValueWithoutDefault), WTFMove(enumerationValueWithDefault), WTFMove(enumerationValueWithEmptyStringDefault), WTFMove(stringWithDefault), WTFMove(stringWithoutDefault), WTFMove(booleanWithDefault), WTFMove(booleanWithoutDefault), WTFMove(sequenceOfStrings), WTFMove(restrictedDouble), WTFMove(unrestrictedDouble), WTFMove(restrictedDoubleWithDefault), WTFMove(unrestrictedDoubleWithDefault), WTFMove(restrictedFloat), WTFMove(unrestrictedFloat), WTFMove(restrictedFloatWithDefault), WTFMove(unrestrictedFloatWithDefault), WTFMove(smallIntegerClamped), WTFMove(smallIntegerWithDefault), WTFMove(smallUnsignedIntegerEnforcedRange), WTFMove(smallUnsignedIntegerWithDefault), WTFMove(integer), WTFMove(integerWithDefault), WTFMove(unsignedInteger), WTFMove(unsignedIntegerWithDefault), WTFMove(largeInteger), WTFMove(largeIntegerWithDefault), WTFMove(unsignedLargeInteger), WTFMove(unsignedLargeIntegerWithDefault), WTF
Move(nullableNode), WTFMove(anyValue), WTFMove(anyTypedefValue), dictionaryMember.value() };
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -755,15 +755,6 @@
</span><span class="cx"> throwTypeError(&state, throwScope);
</span><span class="cx"> return Nullopt;
</span><span class="cx"> }
</span><del>- JSValue requiredEnumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "requiredEnumerationValue"));
- TestObj::EnumType requiredEnumerationValue;
- if (!requiredEnumerationValueValue.isUndefined()) {
- requiredEnumerationValue = convert<TestObj::EnumType>(state, requiredEnumerationValueValue);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- } else {
- throwTypeError(&state, throwScope);
- return Nullopt;
- }
</del><span class="cx"> JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
</span><span class="cx"> Converter<bool>::OptionalValue booleanWithoutDefault;
</span><span class="cx"> if (!booleanWithoutDefaultValue.isUndefined()) {
</span><span class="lines">@@ -788,6 +779,15 @@
</span><span class="cx"> throwTypeError(&state, throwScope);
</span><span class="cx"> return Nullopt;
</span><span class="cx"> }
</span><ins>+ JSValue requiredEnumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "requiredEnumerationValue"));
+ TestObj::EnumType requiredEnumerationValue;
+ if (!requiredEnumerationValueValue.isUndefined()) {
+ requiredEnumerationValue = convert<TestObj::EnumType>(state, requiredEnumerationValueValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ } else {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
</ins><span class="cx"> return TestObj::DictionaryThatShouldNotTolerateNull { WTFMove(requiredEnumerationValue), WTFMove(booleanWithoutDefault), *nonNullableNode, requiredDictionaryMember.value() };
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -805,6 +805,12 @@
</span><span class="cx"> throwTypeError(&state, throwScope);
</span><span class="cx"> return Nullopt;
</span><span class="cx"> }
</span><ins>+ JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
+ Converter<bool>::OptionalValue booleanWithoutDefault;
+ if (!booleanWithoutDefaultValue.isUndefined()) {
+ booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
</ins><span class="cx"> JSValue enumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValue"));
</span><span class="cx"> Converter<TestObj::EnumType>::OptionalValue enumerationValue;
</span><span class="cx"> if (!enumerationValueValue.isUndefined()) {
</span><span class="lines">@@ -811,12 +817,6 @@
</span><span class="cx"> enumerationValue = convert<TestObj::EnumType>(state, enumerationValueValue);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> }
</span><del>- JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
- Converter<bool>::OptionalValue booleanWithoutDefault;
- if (!booleanWithoutDefaultValue.isUndefined()) {
- booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
- RETURN_IF_EXCEPTION(throwScope, Nullopt);
- }
</del><span class="cx"> return TestObj::DictionaryThatShouldTolerateNull { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -834,6 +834,12 @@
</span><span class="cx"> throwTypeError(&state, throwScope);
</span><span class="cx"> return Nullopt;
</span><span class="cx"> }
</span><ins>+ JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
+ Converter<bool>::OptionalValue booleanWithoutDefault;
+ if (!booleanWithoutDefaultValue.isUndefined()) {
+ booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
</ins><span class="cx"> JSValue enumerationValueValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "enumerationValue"));
</span><span class="cx"> Converter<TestObj::EnumType>::OptionalValue enumerationValue;
</span><span class="cx"> if (!enumerationValueValue.isUndefined()) {
</span><span class="lines">@@ -840,15 +846,79 @@
</span><span class="cx"> enumerationValue = convert<TestObj::EnumType>(state, enumerationValueValue);
</span><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> }
</span><del>- JSValue booleanWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "booleanWithoutDefault"));
- Converter<bool>::OptionalValue booleanWithoutDefault;
- if (!booleanWithoutDefaultValue.isUndefined()) {
- booleanWithoutDefault = convert<bool>(state, booleanWithoutDefaultValue);
</del><ins>+ return AlternateDictionaryName { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
+}
+
+template<> Optional<TestObj::ParentDictionary> convertDictionary<TestObj::ParentDictionary>(ExecState& state, JSValue value)
+{
+ VM& vm = state.vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ bool isNullOrUndefined = value.isUndefinedOrNull();
+ auto* object = isNullOrUndefined ? nullptr : value.getObject();
+ if (UNLIKELY(!isNullOrUndefined && !object)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ if (UNLIKELY(object && object->type() == RegExpObjectType)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ JSValue parentMember1Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "parentMember1"));
+ Converter<bool>::OptionalValue parentMember1;
+ if (!parentMember1Value.isUndefined()) {
+ parentMember1 = convert<bool>(state, parentMember1Value);
</ins><span class="cx"> RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx"> }
</span><del>- return AlternateDictionaryName { WTFMove(enumerationValue), WTFMove(booleanWithoutDefault) };
</del><ins>+ JSValue parentMember2Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "parentMember2"));
+ Converter<bool>::OptionalValue parentMember2;
+ if (!parentMember2Value.isUndefined()) {
+ parentMember2 = convert<bool>(state, parentMember2Value);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ return TestObj::ParentDictionary { WTFMove(parentMember2), WTFMove(parentMember1) };
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+template<> Optional<TestObj::ChildDictionary> convertDictionary<TestObj::ChildDictionary>(ExecState& state, JSValue value)
+{
+ VM& vm = state.vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ bool isNullOrUndefined = value.isUndefinedOrNull();
+ auto* object = isNullOrUndefined ? nullptr : value.getObject();
+ if (UNLIKELY(!isNullOrUndefined && !object)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ if (UNLIKELY(object && object->type() == RegExpObjectType)) {
+ throwTypeError(&state, throwScope);
+ return Nullopt;
+ }
+ JSValue parentMember1Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "parentMember1"));
+ Converter<bool>::OptionalValue parentMember1;
+ if (!parentMember1Value.isUndefined()) {
+ parentMember1 = convert<bool>(state, parentMember1Value);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue parentMember2Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "parentMember2"));
+ Converter<bool>::OptionalValue parentMember2;
+ if (!parentMember2Value.isUndefined()) {
+ parentMember2 = convert<bool>(state, parentMember2Value);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue childMember1Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "childMember1"));
+ Converter<bool>::OptionalValue childMember1;
+ if (!childMember1Value.isUndefined()) {
+ childMember1 = convert<bool>(state, childMember1Value);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ JSValue childMember2Value = isNullOrUndefined ? jsUndefined() : object->get(&state, Identifier::fromString(&state, "childMember2"));
+ Converter<bool>::OptionalValue childMember2;
+ if (!childMember2Value.isUndefined()) {
+ childMember2 = convert<bool>(state, childMember2Value);
+ RETURN_IF_EXCEPTION(throwScope, Nullopt);
+ }
+ return TestObj::ChildDictionary { WTFMove(parentMember2), WTFMove(parentMember1), WTFMove(childMember2), WTFMove(childMember1) };
+}
+
</ins><span class="cx"> // Functions
</span><span class="cx">
</span><span class="cx"> #if ENABLE(TEST_FEATURE)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (206775 => 206776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-10-04 18:45:20 UTC (rev 206775)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-10-04 18:51:44 UTC (rev 206776)
</span><span class="lines">@@ -474,3 +474,14 @@
</span><span class="cx"> TestEnumType enumerationValue;
</span><span class="cx"> boolean booleanWithoutDefault;
</span><span class="cx"> };
</span><ins>+
+dictionary ParentDictionary {
+ boolean parentMember2;
+ boolean parentMember1;
+};
+
+dictionary ChildDictionary : ParentDictionary {
+ boolean childMember2;
+ boolean childMember1;
+};
+
</ins></span></pre></div>
<a id="trunkSourceWebCoredomEventTargetidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/EventTarget.idl (206775 => 206776)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/EventTarget.idl        2016-10-04 18:45:20 UTC (rev 206775)
+++ trunk/Source/WebCore/dom/EventTarget.idl        2016-10-04 18:51:44 UTC (rev 206776)
</span><span class="lines">@@ -42,8 +42,7 @@
</span><span class="cx"> boolean capture = false;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-dictionary AddEventListenerOptions {
- boolean capture = false;
</del><ins>+dictionary AddEventListenerOptions : EventListenerOptions {
</ins><span class="cx"> boolean passive = false;
</span><span class="cx"> boolean once = false;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>