<!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>[214139] trunk</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/214139">214139</a></dd>
<dt>Author</dt> <dd>jonlee@apple.com</dd>
<dt>Date</dt> <dd>2017-03-18 13:22:18 -0700 (Sat, 18 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
https://bugs.webkit.org/show_bug.cgi?id=169731

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline tests. The results seem to show a problem in the original tests.
* web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_gcm.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm-expected.txt:

Source/WebCore:

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent): Create a new $implementationAsKey. Look for
ImplementedAs, and if it exists, override the value with the alias. Set the parameters of
convert&lt;&gt;() using JSValueToNative.
(IsValidContextForJSValueToNative): Update to include IDLDictionaryMembers.
(JSValueToNative): Bypass parseEnumeration serialization for enums if the context is an
IDLDictionaryMember. Dictionary members need convert&lt;IDLEnumeration&gt; which throw a TypeError
or return the enum (and utilizes parseEnumeration). parseEnumeration, in contrast, returns
an optional.

* bindings/scripts/test/TestObj.idl: Add test cases in TestDictionary.

Update test results.
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:

LayoutTests:

Rebaseline. The enhancement progressed the results of these tests.
* crypto/subtle/aes-gcm-encrypt-malformed-parameters-expected.txt:
* crypto/subtle/aes-generate-key-malformed-parameters-expected.txt:
* crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesgcmencryptmalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-gcm-encrypt-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesgeneratekeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacgeneratekeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebCryptoAPIencrypt_decryptaes_gcmworkerexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_gcm.worker-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsWebCryptoAPIencrypt_decrypttest_aes_gcmexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestEventConstructorcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestStandaloneDictionarycpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.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="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/LayoutTests/ChangeLog        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-03-18  Jon Lee  &lt;jonlee@apple.com&gt;
+
+        Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
+        https://bugs.webkit.org/show_bug.cgi?id=169731
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline. The enhancement progressed the results of these tests.
+        * crypto/subtle/aes-gcm-encrypt-malformed-parameters-expected.txt:
+        * crypto/subtle/aes-generate-key-malformed-parameters-expected.txt:
+        * crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt:
+
</ins><span class="cx"> 2017-03-18  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Allow setting the prototype of cross-origin objects, as long as they don't change
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesgcmencryptmalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-gcm-encrypt-malformed-parameters-expected.txt (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-gcm-encrypt-malformed-parameters-expected.txt        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/LayoutTests/crypto/subtle/aes-gcm-encrypt-malformed-parameters-expected.txt        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> PASS crypto.subtle.encrypt({name: &quot;aes-gcm&quot;, iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMrd&quot;), tagLength: 0}, key, plainText) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><del>-PASS crypto.subtle.encrypt({name: &quot;aes-gcm&quot;, iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMrd&quot;), tagLength: -1}, key, plainText) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</del><ins>+PASS crypto.subtle.encrypt({name: &quot;aes-gcm&quot;, iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMrd&quot;), tagLength: -1}, key, plainText) rejected promise  with TypeError: Value -1 is outside the range [0, 255].
</ins><span class="cx"> PASS crypto.subtle.encrypt({name: &quot;aes-gcm&quot;, iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMrd&quot;), tagLength: 129}, key, plainText) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><span class="cx"> PASS crypto.subtle.encrypt({name: &quot;aes-gcm&quot;, iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMrd&quot;), tagLength: 70}, key, plainText) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesgeneratekeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -9,8 +9,8 @@
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: null}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: undefined}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Member AesKeyParams.length is required and must be an instance of unsigned short.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: Symbol()}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Cannot convert a symbol to a number.
</span><del>-PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: { }}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
-PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: &quot;foo&quot;}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</del><ins>+PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: { }}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Value NaN is outside the range [0, 65535].
+PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: &quot;foo&quot;}, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]) rejected promise  with TypeError: Value NaN is outside the range [0, 65535].
</ins><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: 128}, extractable, [&quot;sign&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: 128}, extractable, [&quot;verify&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;aes-cbc&quot;, length: 128}, extractable, [&quot;deriveKey&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacgeneratekeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/LayoutTests/crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -7,8 +7,8 @@
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;hmac&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with TypeError: Member HmacKeyParams.hash is required and must be an instance of any.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: null}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: Symbol()}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with TypeError: Cannot convert a symbol to a number.
</span><del>-PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: { }}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
-PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: &quot;foo&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</del><ins>+PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: { }}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with TypeError: Value NaN is outside the range [0, 4294967295].
+PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;, length: &quot;foo&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with TypeError: Value NaN is outside the range [0, 4294967295].
</ins><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;decrypt&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;deriveKey&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-03-18  Jon Lee  &lt;jonlee@apple.com&gt;
+
+        Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
+        https://bugs.webkit.org/show_bug.cgi?id=169731
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline tests. The results seem to show a problem in the original tests.
+        * web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_gcm.worker-expected.txt:
+        * web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm-expected.txt:
+
</ins><span class="cx"> 2017-03-18  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         innerText setter inserts empty text node if value starts with newline
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebCryptoAPIencrypt_decryptaes_gcmworkerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_gcm.worker-expected.txt (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_gcm.worker-expected.txt        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_gcm.worker-expected.txt        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -298,35 +298,35 @@
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 72-bits 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 95-bits 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 129-bits 
</span><del>-PASS AES-GCM 128-bit key, illegal tag length 256-bits 
</del><ins>+FAIL AES-GCM 128-bit key, illegal tag length 256-bits assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 24-bits 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 48-bits 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 72-bits 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 95-bits 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 129-bits 
</span><del>-PASS AES-GCM 192-bit key, illegal tag length 256-bits 
</del><ins>+FAIL AES-GCM 192-bit key, illegal tag length 256-bits assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 24-bits 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 48-bits 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 72-bits 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 95-bits 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 129-bits 
</span><del>-PASS AES-GCM 256-bit key, illegal tag length 256-bits 
</del><ins>+FAIL AES-GCM 256-bit key, illegal tag length 256-bits assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 24-bits decryption 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 48-bits decryption 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 72-bits decryption 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 95-bits decryption 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 129-bits decryption 
</span><del>-PASS AES-GCM 128-bit key, illegal tag length 256-bits decryption 
</del><ins>+FAIL AES-GCM 128-bit key, illegal tag length 256-bits decryption assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 24-bits decryption 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 48-bits decryption 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 72-bits decryption 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 95-bits decryption 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 129-bits decryption 
</span><del>-PASS AES-GCM 192-bit key, illegal tag length 256-bits decryption 
</del><ins>+FAIL AES-GCM 192-bit key, illegal tag length 256-bits decryption assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 24-bits decryption 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 48-bits decryption 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 72-bits decryption 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 95-bits decryption 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 129-bits decryption 
</span><del>-PASS AES-GCM 256-bit key, illegal tag length 256-bits decryption 
</del><ins>+FAIL AES-GCM 256-bit key, illegal tag length 256-bits decryption assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsWebCryptoAPIencrypt_decrypttest_aes_gcmexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm-expected.txt (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm-expected.txt        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm-expected.txt        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -300,35 +300,35 @@
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 72-bits 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 95-bits 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 129-bits 
</span><del>-PASS AES-GCM 128-bit key, illegal tag length 256-bits 
</del><ins>+FAIL AES-GCM 128-bit key, illegal tag length 256-bits assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 24-bits 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 48-bits 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 72-bits 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 95-bits 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 129-bits 
</span><del>-PASS AES-GCM 192-bit key, illegal tag length 256-bits 
</del><ins>+FAIL AES-GCM 192-bit key, illegal tag length 256-bits assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 24-bits 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 48-bits 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 72-bits 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 95-bits 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 129-bits 
</span><del>-PASS AES-GCM 256-bit key, illegal tag length 256-bits 
</del><ins>+FAIL AES-GCM 256-bit key, illegal tag length 256-bits assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 24-bits decryption 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 48-bits decryption 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 72-bits decryption 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 95-bits decryption 
</span><span class="cx"> PASS AES-GCM 128-bit key, illegal tag length 129-bits decryption 
</span><del>-PASS AES-GCM 128-bit key, illegal tag length 256-bits decryption 
</del><ins>+FAIL AES-GCM 128-bit key, illegal tag length 256-bits decryption assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 24-bits decryption 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 48-bits decryption 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 72-bits decryption 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 95-bits decryption 
</span><span class="cx"> PASS AES-GCM 192-bit key, illegal tag length 129-bits decryption 
</span><del>-PASS AES-GCM 192-bit key, illegal tag length 256-bits decryption 
</del><ins>+FAIL AES-GCM 192-bit key, illegal tag length 256-bits decryption assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 24-bits decryption 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 48-bits decryption 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 72-bits decryption 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 95-bits decryption 
</span><span class="cx"> PASS AES-GCM 256-bit key, illegal tag length 129-bits decryption 
</span><del>-PASS AES-GCM 256-bit key, illegal tag length 256-bits decryption 
</del><ins>+FAIL AES-GCM 256-bit key, illegal tag length 256-bits decryption assert_equals: Should throw an OperationError instead of Type error expected &quot;OperationError&quot; but got &quot;TypeError&quot;
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/Source/WebCore/ChangeLog        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2017-03-18  Jon Lee  &lt;jonlee@apple.com&gt;
+
+        Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
+        https://bugs.webkit.org/show_bug.cgi?id=169731
+
+        Reviewed by Alex Christensen.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateDictionaryImplementationContent): Create a new $implementationAsKey. Look for
+        ImplementedAs, and if it exists, override the value with the alias. Set the parameters of
+        convert&lt;&gt;() using JSValueToNative.
+        (IsValidContextForJSValueToNative): Update to include IDLDictionaryMembers.
+        (JSValueToNative): Bypass parseEnumeration serialization for enums if the context is an
+        IDLDictionaryMember. Dictionary members need convert&lt;IDLEnumeration&gt; which throw a TypeError
+        or return the enum (and utilizes parseEnumeration). parseEnumeration, in contrast, returns
+        an optional.
+
+        * bindings/scripts/test/TestObj.idl: Add test cases in TestDictionary.
+
+        Update test results.
+        * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
+
</ins><span class="cx"> 2017-03-18  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use initializers for Document member variables
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -1562,6 +1562,7 @@
</span><span class="cx"> 
</span><span class="cx">             # 5.1. Let key be the identifier of member.
</span><span class="cx">             my $key = $member-&gt;name;
</span><ins>+            my $implementedAsKey = $member-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;} ? $member-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;} : $key;
</ins><span class="cx"> 
</span><span class="cx">             # 5.2. Let value be an ECMAScript value, depending on Type(V):
</span><span class="cx">             $result .= &quot;    JSValue ${key}Value = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, \&quot;${key}\&quot;));\n&quot;;
</span><span class="lines">@@ -1570,7 +1571,9 @@
</span><span class="cx"> 
</span><span class="cx">             # 5.3. If value is not undefined, then:
</span><span class="cx">             $result .= &quot;    if (!${key}Value.isUndefined()) {\n&quot;;
</span><del>-            $result .= &quot;        result.$key = convert&lt;${IDLType}&gt;(state, ${key}Value);\n&quot;;
</del><ins>+
+            my ($nativeValue, $mayThrowException) = JSValueToNative($typeScope, $member, &quot;${key}Value&quot;, $member-&gt;extendedAttributes-&gt;{Conditional}, &quot;&amp;state&quot;, &quot;state&quot;);
+            $result .= &quot;        result.$implementedAsKey = $nativeValue;\n&quot;;
</ins><span class="cx">             $result .= &quot;        RETURN_IF_EXCEPTION(throwScope, { });\n&quot;;
</span><span class="cx"> 
</span><span class="cx">             # Value is undefined.
</span><span class="lines">@@ -1577,7 +1580,7 @@
</span><span class="cx">             # 5.4. Otherwise, if value is undefined but the dictionary member has a default value, then:
</span><span class="cx">             if (!$member-&gt;isRequired &amp;&amp; defined $member-&gt;default) {
</span><span class="cx">                 $result .= &quot;    } else\n&quot;;
</span><del>-                $result .= &quot;        result.$key = &quot; . GenerateDefaultValue($typeScope, $member, $member-&gt;type, $member-&gt;default) . &quot;;\n&quot;;
</del><ins>+                $result .= &quot;        result.$implementedAsKey = &quot; . GenerateDefaultValue($typeScope, $member, $member-&gt;type, $member-&gt;default) . &quot;;\n&quot;;
</ins><span class="cx">             } elsif ($member-&gt;isRequired) {
</span><span class="cx">                 # 5.5. Otherwise, if value is undefined and the dictionary member is a required dictionary member, then throw a TypeError.
</span><span class="cx">                 $result .= &quot;    } else {\n&quot;;
</span><span class="lines">@@ -1611,7 +1614,7 @@
</span><span class="cx">             my @sortedMembers = sort { $a-&gt;name cmp $b-&gt;name } @{$dictionary-&gt;members};
</span><span class="cx">             foreach my $member (@sortedMembers) {
</span><span class="cx">                 my $key = $member-&gt;name;
</span><del>-                my $IDLType = GetIDLType($typeScope, $member-&gt;type);
</del><ins>+                my $implementedAsKey = $member-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;} ? $member-&gt;extendedAttributes-&gt;{&quot;ImplementedAs&quot;} : $key;
</ins><span class="cx"> 
</span><span class="cx">                 # 1. Let key be the identifier of member.
</span><span class="cx">                 # 2. If the dictionary member named key is present in V, then:
</span><span class="lines">@@ -1618,13 +1621,14 @@
</span><span class="cx">                     # 1. Let idlValue be the value of member on V.
</span><span class="cx">                     # 2. Let value be the result of converting idlValue to an ECMAScript value.
</span><span class="cx">                     # 3. Perform ! CreateDataProperty(O, key, value).
</span><ins>+                my $IDLType = GetIDLType($typeScope, $member-&gt;type);
</ins><span class="cx">                 if (!$member-&gt;isRequired &amp;&amp; not defined $member-&gt;default) {
</span><del>-                    $result .= &quot;    if (!${IDLType}::isNullValue(dictionary.${key})) {\n&quot;;
-                    $result .= &quot;        auto ${key}Value = toJS&lt;$IDLType&gt;(state, globalObject, ${IDLType}::extractValueFromNullable(dictionary.${key}));\n&quot;;
</del><ins>+                    $result .= &quot;    if (!${IDLType}::isNullValue(dictionary.${implementedAsKey})) {\n&quot;;
+                    $result .= &quot;        auto ${key}Value = toJS&lt;$IDLType&gt;(state, globalObject, ${IDLType}::extractValueFromNullable(dictionary.${implementedAsKey}));\n&quot;;
</ins><span class="cx">                     $result .= &quot;        result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, \&quot;${key}\&quot;), ${key}Value);\n&quot;;
</span><span class="cx">                     $result .= &quot;    }\n&quot;;
</span><span class="cx">                 } else {
</span><del>-                    $result .= &quot;    auto ${key}Value = toJS&lt;$IDLType&gt;(state, globalObject, dictionary.${key});\n&quot;;
</del><ins>+                    $result .= &quot;    auto ${key}Value = toJS&lt;$IDLType&gt;(state, globalObject, dictionary.${implementedAsKey});\n&quot;;
</ins><span class="cx">                     $result .= &quot;    result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, \&quot;${key}\&quot;), ${key}Value);\n&quot;;
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="lines">@@ -5511,8 +5515,7 @@
</span><span class="cx"> sub IsValidContextForJSValueToNative
</span><span class="cx"> {
</span><span class="cx">     my $context = shift;
</span><del>-    
-    return ref($context) eq &quot;IDLAttribute&quot; || ref($context) eq &quot;IDLArgument&quot;;
</del><ins>+    return ref($context) eq &quot;IDLAttribute&quot; || ref($context) eq &quot;IDLArgument&quot; || ref($context) eq &quot;IDLDictionaryMember&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> # Returns (convertString, mayThrowException).
</span><span class="lines">@@ -5537,7 +5540,9 @@
</span><span class="cx">         return (&quot;$value.toString($statePointer)-&gt;toAtomicString($statePointer)&quot;, 1) if $context-&gt;extendedAttributes-&gt;{AtomicString};
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if ($codeGenerator-&gt;IsEnumType($type)) {
</del><ins>+    # parseEnumeration&lt;&gt; returns a std::optional. For dictionary members we need convert&lt;IDLEnumeration&gt;() which guarantee
+    # the enum, or throws a TypeError. Bypass this check for IDLDictionaryMembers.
+    if ($codeGenerator-&gt;IsEnumType($type) &amp;&amp; ref($context) ne &quot;IDLDictionaryMember&quot;) {
</ins><span class="cx">         return (&quot;parseEnumeration&lt;&quot; . GetEnumerationClassName($type, $interface) . &quot;&gt;($stateReference, $value)&quot;, 1);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestEventConstructorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -68,13 +68,13 @@
</span><span class="cx">         result.composed = false;
</span><span class="cx">     JSValue attr2Value = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;attr2&quot;));
</span><span class="cx">     if (!attr2Value.isUndefined()) {
</span><del>-        result.attr2 = convert&lt;IDLDOMString&gt;(state, attr2Value);
</del><ins>+        result.attr2 = convert&lt;IDLDOMString&gt;(state, attr2Value, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.attr2 = emptyString();
</span><span class="cx">     JSValue attr3Value = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;attr3&quot;));
</span><span class="cx">     if (!attr3Value.isUndefined()) {
</span><del>-        result.attr3 = convert&lt;IDLDOMString&gt;(state, attr3Value);
</del><ins>+        result.attr3 = convert&lt;IDLDOMString&gt;(state, attr3Value, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.attr3 = emptyString();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -532,31 +532,43 @@
</span><span class="cx">         result.enumerationValueWithoutDefault = convert&lt;IDLEnumeration&lt;TestObj::EnumType&gt;&gt;(state, enumerationValueWithoutDefaultValue);
</span><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><ins>+    JSValue fooAliasValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;fooAlias&quot;));
+    if (!fooAliasValue.isUndefined()) {
+        result.foo = convert&lt;IDLAny&gt;(state, fooAliasValue);
+        RETURN_IF_EXCEPTION(throwScope, { });
+    } else
+        result.foo = jsUndefined();
+    JSValue fooWithDefaultAliasValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;fooWithDefaultAlias&quot;));
+    if (!fooWithDefaultAliasValue.isUndefined()) {
+        result.fooWithDefault = convert&lt;IDLAny&gt;(state, fooWithDefaultAliasValue);
+        RETURN_IF_EXCEPTION(throwScope, { });
+    } else
+        result.fooWithDefault = 0;
</ins><span class="cx">     JSValue integerValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;integer&quot;));
</span><span class="cx">     if (!integerValue.isUndefined()) {
</span><del>-        result.integer = convert&lt;IDLLong&gt;(state, integerValue);
</del><ins>+        result.integer = convert&lt;IDLLong&gt;(state, integerValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     JSValue integerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;integerWithDefault&quot;));
</span><span class="cx">     if (!integerWithDefaultValue.isUndefined()) {
</span><del>-        result.integerWithDefault = convert&lt;IDLLong&gt;(state, integerWithDefaultValue);
</del><ins>+        result.integerWithDefault = convert&lt;IDLLong&gt;(state, integerWithDefaultValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.integerWithDefault = 0;
</span><span class="cx">     JSValue largeIntegerValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;largeInteger&quot;));
</span><span class="cx">     if (!largeIntegerValue.isUndefined()) {
</span><del>-        result.largeInteger = convert&lt;IDLLongLong&gt;(state, largeIntegerValue);
</del><ins>+        result.largeInteger = convert&lt;IDLLongLong&gt;(state, largeIntegerValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     JSValue largeIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;largeIntegerWithDefault&quot;));
</span><span class="cx">     if (!largeIntegerWithDefaultValue.isUndefined()) {
</span><del>-        result.largeIntegerWithDefault = convert&lt;IDLLongLong&gt;(state, largeIntegerWithDefaultValue);
</del><ins>+        result.largeIntegerWithDefault = convert&lt;IDLLongLong&gt;(state, largeIntegerWithDefaultValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.largeIntegerWithDefault = 0;
</span><span class="cx">     JSValue nullableIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;nullableIntegerWithDefault&quot;));
</span><span class="cx">     if (!nullableIntegerWithDefaultValue.isUndefined()) {
</span><del>-        result.nullableIntegerWithDefault = convert&lt;IDLNullable&lt;IDLLong&gt;&gt;(state, nullableIntegerWithDefaultValue);
</del><ins>+        result.nullableIntegerWithDefault = convert&lt;IDLNullable&lt;IDLLong&gt;&gt;(state, nullableIntegerWithDefaultValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.nullableIntegerWithDefault = std::nullopt;
</span><span class="lines">@@ -568,7 +580,7 @@
</span><span class="cx">         result.nullableNode = nullptr;
</span><span class="cx">     JSValue nullableStringWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;nullableStringWithDefault&quot;));
</span><span class="cx">     if (!nullableStringWithDefaultValue.isUndefined()) {
</span><del>-        result.nullableStringWithDefault = convert&lt;IDLNullable&lt;IDLDOMString&gt;&gt;(state, nullableStringWithDefaultValue);
</del><ins>+        result.nullableStringWithDefault = convert&lt;IDLNullable&lt;IDLDOMString&gt;&gt;(state, nullableStringWithDefaultValue, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.nullableStringWithDefault = String();
</span><span class="lines">@@ -607,34 +619,39 @@
</span><span class="cx">     }
</span><span class="cx">     JSValue smallIntegerClampedValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;smallIntegerClamped&quot;));
</span><span class="cx">     if (!smallIntegerClampedValue.isUndefined()) {
</span><del>-        result.smallIntegerClamped = convert&lt;IDLByte&gt;(state, smallIntegerClampedValue);
</del><ins>+        result.smallIntegerClamped = convert&lt;IDLByte&gt;(state, smallIntegerClampedValue, IntegerConversionConfiguration::Clamp);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     JSValue smallIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;smallIntegerWithDefault&quot;));
</span><span class="cx">     if (!smallIntegerWithDefaultValue.isUndefined()) {
</span><del>-        result.smallIntegerWithDefault = convert&lt;IDLByte&gt;(state, smallIntegerWithDefaultValue);
</del><ins>+        result.smallIntegerWithDefault = convert&lt;IDLByte&gt;(state, smallIntegerWithDefaultValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     JSValue smallUnsignedIntegerEnforcedRangeValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;smallUnsignedIntegerEnforcedRange&quot;));
</span><span class="cx">     if (!smallUnsignedIntegerEnforcedRangeValue.isUndefined()) {
</span><del>-        result.smallUnsignedIntegerEnforcedRange = convert&lt;IDLOctet&gt;(state, smallUnsignedIntegerEnforcedRangeValue);
</del><ins>+        result.smallUnsignedIntegerEnforcedRange = convert&lt;IDLOctet&gt;(state, smallUnsignedIntegerEnforcedRangeValue, IntegerConversionConfiguration::EnforceRange);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     JSValue smallUnsignedIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;smallUnsignedIntegerWithDefault&quot;));
</span><span class="cx">     if (!smallUnsignedIntegerWithDefaultValue.isUndefined()) {
</span><del>-        result.smallUnsignedIntegerWithDefault = convert&lt;IDLOctet&gt;(state, smallUnsignedIntegerWithDefaultValue);
</del><ins>+        result.smallUnsignedIntegerWithDefault = convert&lt;IDLOctet&gt;(state, smallUnsignedIntegerWithDefaultValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.smallUnsignedIntegerWithDefault = 0;
</span><ins>+    JSValue stringTreatNullAsEmptyStringValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;stringTreatNullAsEmptyString&quot;));
+    if (!stringTreatNullAsEmptyStringValue.isUndefined()) {
+        result.stringTreatNullAsEmptyString = convert&lt;IDLDOMString&gt;(state, stringTreatNullAsEmptyStringValue, StringConversionConfiguration::TreatNullAsEmptyString);
+        RETURN_IF_EXCEPTION(throwScope, { });
+    }
</ins><span class="cx">     JSValue stringWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;stringWithDefault&quot;));
</span><span class="cx">     if (!stringWithDefaultValue.isUndefined()) {
</span><del>-        result.stringWithDefault = convert&lt;IDLDOMString&gt;(state, stringWithDefaultValue);
</del><ins>+        result.stringWithDefault = convert&lt;IDLDOMString&gt;(state, stringWithDefaultValue, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.stringWithDefault = ASCIILiteral(&quot;defaultString&quot;);
</span><span class="cx">     JSValue stringWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;stringWithoutDefault&quot;));
</span><span class="cx">     if (!stringWithoutDefaultValue.isUndefined()) {
</span><del>-        result.stringWithoutDefault = convert&lt;IDLDOMString&gt;(state, stringWithoutDefaultValue);
</del><ins>+        result.stringWithoutDefault = convert&lt;IDLDOMString&gt;(state, stringWithoutDefaultValue, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     JSValue unionMemberValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;unionMember&quot;));
</span><span class="lines">@@ -666,23 +683,23 @@
</span><span class="cx">         result.unrestrictedFloatWithDefault = 0;
</span><span class="cx">     JSValue unsignedIntegerValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;unsignedInteger&quot;));
</span><span class="cx">     if (!unsignedIntegerValue.isUndefined()) {
</span><del>-        result.unsignedInteger = convert&lt;IDLUnsignedLong&gt;(state, unsignedIntegerValue);
</del><ins>+        result.unsignedInteger = convert&lt;IDLUnsignedLong&gt;(state, unsignedIntegerValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     JSValue unsignedIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;unsignedIntegerWithDefault&quot;));
</span><span class="cx">     if (!unsignedIntegerWithDefaultValue.isUndefined()) {
</span><del>-        result.unsignedIntegerWithDefault = convert&lt;IDLUnsignedLong&gt;(state, unsignedIntegerWithDefaultValue);
</del><ins>+        result.unsignedIntegerWithDefault = convert&lt;IDLUnsignedLong&gt;(state, unsignedIntegerWithDefaultValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.unsignedIntegerWithDefault = 0;
</span><span class="cx">     JSValue unsignedLargeIntegerValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;unsignedLargeInteger&quot;));
</span><span class="cx">     if (!unsignedLargeIntegerValue.isUndefined()) {
</span><del>-        result.unsignedLargeInteger = convert&lt;IDLUnsignedLongLong&gt;(state, unsignedLargeIntegerValue);
</del><ins>+        result.unsignedLargeInteger = convert&lt;IDLUnsignedLongLong&gt;(state, unsignedLargeIntegerValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     JSValue unsignedLargeIntegerWithDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;unsignedLargeIntegerWithDefault&quot;));
</span><span class="cx">     if (!unsignedLargeIntegerWithDefaultValue.isUndefined()) {
</span><del>-        result.unsignedLargeIntegerWithDefault = convert&lt;IDLUnsignedLongLong&gt;(state, unsignedLargeIntegerWithDefaultValue);
</del><ins>+        result.unsignedLargeIntegerWithDefault = convert&lt;IDLUnsignedLongLong&gt;(state, unsignedLargeIntegerWithDefaultValue, IntegerConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     } else
</span><span class="cx">         result.unsignedLargeIntegerWithDefault = 0;
</span><span class="lines">@@ -723,6 +740,10 @@
</span><span class="cx">         auto enumerationValueWithoutDefaultValue = toJS&lt;IDLEnumeration&lt;TestObj::EnumType&gt;&gt;(state, globalObject, IDLEnumeration&lt;TestObj::EnumType&gt;::extractValueFromNullable(dictionary.enumerationValueWithoutDefault));
</span><span class="cx">         result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, &quot;enumerationValueWithoutDefault&quot;), enumerationValueWithoutDefaultValue);
</span><span class="cx">     }
</span><ins>+    auto fooAliasValue = toJS&lt;IDLAny&gt;(state, globalObject, dictionary.foo);
+    result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, &quot;fooAlias&quot;), fooAliasValue);
+    auto fooWithDefaultAliasValue = toJS&lt;IDLAny&gt;(state, globalObject, dictionary.fooWithDefault);
+    result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, &quot;fooWithDefaultAlias&quot;), fooWithDefaultAliasValue);
</ins><span class="cx">     if (!IDLLong::isNullValue(dictionary.integer)) {
</span><span class="cx">         auto integerValue = toJS&lt;IDLLong&gt;(state, globalObject, IDLLong::extractValueFromNullable(dictionary.integer));
</span><span class="cx">         result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, &quot;integer&quot;), integerValue);
</span><span class="lines">@@ -773,6 +794,10 @@
</span><span class="cx">     }
</span><span class="cx">     auto smallUnsignedIntegerWithDefaultValue = toJS&lt;IDLOctet&gt;(state, globalObject, dictionary.smallUnsignedIntegerWithDefault);
</span><span class="cx">     result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, &quot;smallUnsignedIntegerWithDefault&quot;), smallUnsignedIntegerWithDefaultValue);
</span><ins>+    if (!IDLDOMString::isNullValue(dictionary.stringTreatNullAsEmptyString)) {
+        auto stringTreatNullAsEmptyStringValue = toJS&lt;IDLDOMString&gt;(state, globalObject, IDLDOMString::extractValueFromNullable(dictionary.stringTreatNullAsEmptyString));
+        result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, &quot;stringTreatNullAsEmptyString&quot;), stringTreatNullAsEmptyStringValue);
+    }
</ins><span class="cx">     auto stringWithDefaultValue = toJS&lt;IDLDOMString&gt;(state, globalObject, dictionary.stringWithDefault);
</span><span class="cx">     result-&gt;putDirect(vm, JSC::Identifier::fromString(&amp;vm, &quot;stringWithDefault&quot;), stringWithDefaultValue);
</span><span class="cx">     if (!IDLDOMString::isNullValue(dictionary.stringWithoutDefault)) {
</span><span class="lines">@@ -998,7 +1023,7 @@
</span><span class="cx">     TestObj::ConditionalDictionaryA result;
</span><span class="cx">     JSValue stringWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;stringWithoutDefault&quot;));
</span><span class="cx">     if (!stringWithoutDefaultValue.isUndefined()) {
</span><del>-        result.stringWithoutDefault = convert&lt;IDLDOMString&gt;(state, stringWithoutDefaultValue);
</del><ins>+        result.stringWithoutDefault = convert&lt;IDLDOMString&gt;(state, stringWithoutDefaultValue, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     return result;
</span><span class="lines">@@ -1025,7 +1050,7 @@
</span><span class="cx">     TestObj::ConditionalDictionaryB result;
</span><span class="cx">     JSValue stringWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;stringWithoutDefault&quot;));
</span><span class="cx">     if (!stringWithoutDefaultValue.isUndefined()) {
</span><del>-        result.stringWithoutDefault = convert&lt;IDLDOMString&gt;(state, stringWithoutDefaultValue);
</del><ins>+        result.stringWithoutDefault = convert&lt;IDLDOMString&gt;(state, stringWithoutDefaultValue, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     return result;
</span><span class="lines">@@ -1052,7 +1077,7 @@
</span><span class="cx">     TestObj::ConditionalDictionaryC result;
</span><span class="cx">     JSValue stringWithoutDefaultValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;stringWithoutDefault&quot;));
</span><span class="cx">     if (!stringWithoutDefaultValue.isUndefined()) {
</span><del>-        result.stringWithoutDefault = convert&lt;IDLDOMString&gt;(state, stringWithoutDefaultValue);
</del><ins>+        result.stringWithoutDefault = convert&lt;IDLDOMString&gt;(state, stringWithoutDefaultValue, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     return result;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestStandaloneDictionarycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     }
</span><span class="cx">     JSValue stringMemberValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;stringMember&quot;));
</span><span class="cx">     if (!stringMemberValue.isUndefined()) {
</span><del>-        result.stringMember = convert&lt;IDLDOMString&gt;(state, stringMemberValue);
</del><ins>+        result.stringMember = convert&lt;IDLDOMString&gt;(state, stringMemberValue, StringConversionConfiguration::Normal);
</ins><span class="cx">         RETURN_IF_EXCEPTION(throwScope, { });
</span><span class="cx">     }
</span><span class="cx">     return result;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (214138 => 214139)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2017-03-18 20:21:51 UTC (rev 214138)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2017-03-18 20:22:18 UTC (rev 214139)
</span><span class="lines">@@ -436,7 +436,7 @@
</span><span class="cx"> 
</span><span class="cx"> [
</span><span class="cx">     JSGenerateToJSObject
</span><del>-]dictionary TestDictionary {
</del><ins>+] dictionary TestDictionary {
</ins><span class="cx">     TestEnumType enumerationValueWithoutDefault;
</span><span class="cx">     TestEnumType enumerationValueWithDefault = &quot;enumValue1&quot;;
</span><span class="cx">     TestEnumType enumerationValueWithEmptyStringDefault = &quot;&quot;;
</span><span class="lines">@@ -443,6 +443,7 @@
</span><span class="cx">     DOMString stringWithDefault = &quot;defaultString&quot;;
</span><span class="cx">     DOMString stringWithoutDefault;
</span><span class="cx">     DOMString? nullableStringWithDefault = null;
</span><ins>+    [TreatNullAs=EmptyString] DOMString stringTreatNullAsEmptyString;
</ins><span class="cx">     boolean booleanWithDefault = false;
</span><span class="cx">     boolean booleanWithoutDefault;
</span><span class="cx">     sequence&lt;DOMString&gt; sequenceOfStrings;
</span><span class="lines">@@ -470,6 +471,8 @@
</span><span class="cx">     Node? nullableNode = null;
</span><span class="cx">     any anyValue;
</span><span class="cx">     any anyValueWithNullDefault = null;
</span><ins>+    [ImplementedAs=foo] any fooAlias;
+    [ImplementedAs=fooWithDefault] any fooWithDefaultAlias = 0;
</ins><span class="cx">     AnyTypedef anyTypedefValue;
</span><span class="cx">     TestDictionaryThatShouldTolerateNull dictionaryMember;
</span><span class="cx">     (long or Node) unionMember;
</span></span></pre>
</div>
</div>

</body>
</html>