[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-changes
Subject:    [webkit-changes] [239537] trunk
From:       yusukesuzuki () slowstart ! org
Date:       2018-12-22 6:41:03
Message-ID: 20181222064104.05D3710051CE () svn ! webkit ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!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>[239537] 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/239537">239537</a></dd> \
<dt>Author</dt> <dd>yusukesuzuki@slowstart.org</dd> <dt>Date</dt> <dd>2018-12-21 \
22:41:03 -0800 (Fri, 21 Dec 2018)</dd> </dl>

<h3>Log Message</h3>
<pre>[JSC] Implement &quot;well-formed JSON.stringify&quot; proposal
https://bugs.webkit.org/show_bug.cgi?id=191677

Reviewed by Darin Adler.

JSTests:

* stress/json-surrogate-pair.js: Added.
(shouldBe):
* test262/expectations.yaml:

Source/WTF:

This patch implements &quot;well-formed JSON.stringify&quot; proposal[1], which is \
now stage 3. JSON.stringify appended surrogate pair codes even if it is not paired \
appropriately. The proposal requires that broken surrogate pairs are unicode-escaped.

[1]: https://github.com/tc39/proposal-well-formed-stringify

* wtf/text/StringBuilderJSON.cpp:
(WTF::appendQuotedJSONStringInternal):

LayoutTests:

* css3/escape-dom-api-expected.txt:
* js/dom/webidl-type-mapping-expected.txt:
* js/resources/json2-es5-compat.js:
(isHighSurrogate):
(isLowSurrogate):
(isSurrogate):
(quote):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJSTestsChangeLog">trunk/JSTests/ChangeLog</a></li>
<li><a href="#trunkJSTeststest262expectationsyaml">trunk/JSTests/test262/expectations.yaml</a></li>
 <li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscss3escapedomapiexpectedtxt">trunk/LayoutTests/css3/escape-dom-api-expected.txt</a></li>
 <li><a href="#trunkLayoutTestsjsdomwebidltypemappingexpectedtxt">trunk/LayoutTests/js/dom/webidl-type-mapping-expected.txt</a></li>
 <li><a href="#trunkLayoutTestsjsresourcesjson2es5compatjs">trunk/LayoutTests/js/resources/json2-es5-compat.js</a></li>
 <li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtftextStringBuilderJSONcpp">trunk/Source/WTF/wtf/text/StringBuilderJSON.cpp</a></li>
 </ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkJSTestsstressjsonsurrogatepairjs">trunk/JSTests/stress/json-surrogate-pair.js</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJSTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/ChangeLog (239536 => 239537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JSTests/ChangeLog	2018-12-22 06:39:23 UTC (rev 239536)
+++ trunk/JSTests/ChangeLog	2018-12-22 06:41:03 UTC (rev 239537)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2018-12-20  Yusuke Suzuki  &lt;yusukesuzuki@slowstart.org&gt;
+
+        [JSC] Implement &quot;well-formed JSON.stringify&quot; proposal
+        https://bugs.webkit.org/show_bug.cgi?id=191677
+
+        Reviewed by Darin Adler.
+
+        * stress/json-surrogate-pair.js: Added.
+        (shouldBe):
+        * test262/expectations.yaml:
+
</ins><span class="cx"> 2018-12-20  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for globalThis
</span></span></pre></div>
<a id="trunkJSTestsstressjsonsurrogatepairjs"></a>
<div class="addfile"><h4>Added: trunk/JSTests/stress/json-surrogate-pair.js (0 => \
239537)</h4> <pre class="diff"><span>
<span class="info">--- trunk/JSTests/stress/json-surrogate-pair.js	                   \
                (rev 0)
+++ trunk/JSTests/stress/json-surrogate-pair.js	2018-12-22 06:41:03 UTC (rev 239537)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+shouldBe(JSON.stringify('𝌆'), `&quot;𝌆&quot;`);
+shouldBe(JSON.stringify('\uD834\uDF06'), `&quot;𝌆&quot;`);
+shouldBe(JSON.stringify('\uD834'), `&quot;\\ud834&quot;`);
+shouldBe(JSON.stringify('\uDF06'), `&quot;\\udf06&quot;`);
+shouldBe(JSON.stringify('\uDF06\uD834'), `&quot;\\udf06\\ud834&quot;`);
+shouldBe(JSON.stringify('\uDEAD'), `&quot;\\udead&quot;`);
+shouldBe(JSON.stringify('\uD834\uD834\uDF06'), `&quot;\\ud834𝌆&quot;`);
+shouldBe(JSON.stringify('\uD834a'), `&quot;\\ud834a&quot;`);
+shouldBe(JSON.stringify('\uD834\u0400'), `&quot;\\ud834Ѐ&quot;`);
</ins></span></pre></div>
<a id="trunkJSTeststest262expectationsyaml"></a>
<div class="modfile"><h4>Modified: trunk/JSTests/test262/expectations.yaml (239536 => \
239537)</h4> <pre class="diff"><span>
<span class="info">--- trunk/JSTests/test262/expectations.yaml	2018-12-22 06:39:23 \
                UTC (rev 239536)
+++ trunk/JSTests/test262/expectations.yaml	2018-12-22 06:41:03 UTC (rev 239537)
</span><span class="lines">@@ -1022,9 +1022,6 @@
</span><span class="cx"> test/built-ins/JSON/parse/reviver-array-length-get-err.js:
</span><span class="cx">   default: 'Test262Error: Expected a Test262Error to be \
thrown but no exception was thrown at all' </span><span class="cx">   strict mode: \
'Test262Error: Expected a Test262Error to be thrown but no exception was thrown at \
all' </span><del>-test/built-ins/JSON/stringify/string-escape-unicode.js:
-  default: 'Test262Error: JSON.stringify(&quot;\uD834&quot;) Expected SameValue( \
                «&quot;í ´&quot; »,  «&quot;\ud834&quot; ») to be true'
-  strict mode: 'Test262Error: JSON.stringify(&quot;\uD834&quot;) Expected SameValue( \
«&quot;í ´&quot; »,  «&quot;\ud834&quot; ») to be true' </del><span class="cx"> \
test/built-ins/Map/proto-from-ctor-realm.js: </span><span class="cx">   default: \
'Test262Error: Expected SameValue( «[object Map] »,  «[object Map] ») to be true' \
</span><span class="cx">   strict mode: 'Test262Error: Expected SameValue( «[object \
Map] »,  «[object Map] ») to be true' </span></span></pre></div>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (239536 => \
239537)</h4> <pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog	2018-12-22 06:39:23 UTC (rev \
                239536)
+++ trunk/LayoutTests/ChangeLog	2018-12-22 06:41:03 UTC (rev 239537)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2018-12-20  Yusuke Suzuki  &lt;yusukesuzuki@slowstart.org&gt;
+
+        [JSC] Implement &quot;well-formed JSON.stringify&quot; proposal
+        https://bugs.webkit.org/show_bug.cgi?id=191677
+
+        Reviewed by Darin Adler.
+
+        * css3/escape-dom-api-expected.txt:
+        * js/dom/webidl-type-mapping-expected.txt:
+        * js/resources/json2-es5-compat.js:
+        (isHighSurrogate):
+        (isLowSurrogate):
+        (isSurrogate):
+        (quote):
+
</ins><span class="cx"> 2018-12-21  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         RTCRtpSender.setParameters() does set active \
parameter </span></span></pre></div>
<a id="trunkLayoutTestscss3escapedomapiexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/escape-dom-api-expected.txt \
(239536 => 239537)</h4> <pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/escape-dom-api-expected.txt	2018-12-22 \
                06:39:23 UTC (rev 239536)
+++ trunk/LayoutTests/css3/escape-dom-api-expected.txt	2018-12-22 06:41:03 UTC (rev \
239537) </span><span class="lines">@@ -61,8 +61,8 @@
</span><span class="cx"> PASS CSS.escape('ABCDEFGHIJKLMNOPQRSTUVWXYZ') is \
&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot; </span><span class="cx"> PASS CSS.escape(' \
!xy') is &quot;\\ \\!xy&quot; </span><span class="cx"> PASS CSS.escape('𝌆') is \
&quot;𝌆&quot; </span><del>-PASS CSS.escape('í¼†') is &quot;í¼†&quot;
-PASS CSS.escape('í ´') is &quot;í ´&quot;
</del><ins>+PASS CSS.escape('í¼†') is &quot;\udf06&quot;
+PASS CSS.escape('í ´') is &quot;\ud834&quot;
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsjsdomwebidltypemappingexpectedtxt"></a>
<div class="modfile"><h4>Modified: \
trunk/LayoutTests/js/dom/webidl-type-mapping-expected.txt (239536 => 239537)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/LayoutTests/js/dom/webidl-type-mapping-expected.txt	2018-12-22 06:39:23 UTC \
                (rev 239536)
+++ trunk/LayoutTests/js/dom/webidl-type-mapping-expected.txt	2018-12-22 06:41:03 UTC \
(rev 239537) </span><span class="lines">@@ -1019,26 +1019,26 @@
</span><span class="cx"> PASS converter.testString = {toString: function() { throw \
Error(); }} threw exception Error. </span><span class="cx"> PASS \
converter.testUSVString is &quot;Ā&quot; </span><span class="cx"> PASS \
converter.testString is &quot;Ā&quot; </span><del>-converter.testUSVString = &quot;í \
                €&quot;
-converter.testString = &quot;í €&quot;
</del><ins>+converter.testUSVString = &quot;\ud800&quot;
+converter.testString = &quot;\ud800&quot;
</ins><span class="cx"> PASS converter.testUSVString is &quot;�&quot;
</span><del>-PASS converter.testString is &quot;í €&quot;
-converter.testUSVString = &quot;í°€&quot;
-converter.testString = &quot;í°€&quot;
</del><ins>+PASS converter.testString is &quot;\ud800&quot;
+converter.testUSVString = &quot;\udc00&quot;
+converter.testString = &quot;\udc00&quot;
</ins><span class="cx"> PASS converter.testUSVString is &quot;�&quot;
</span><del>-PASS converter.testString is &quot;í°€&quot;
-converter.testUSVString = &quot;í €\u0000&quot;
-converter.testString = &quot;í €\u0000&quot;
</del><ins>+PASS converter.testString is &quot;\udc00&quot;
+converter.testUSVString = &quot;\ud800\u0000&quot;
+converter.testString = &quot;\ud800\u0000&quot;
</ins><span class="cx"> PASS converter.testUSVString is &quot;�\u0000&quot;
</span><del>-PASS converter.testString is &quot;í €\u0000&quot;
-converter.testUSVString = &quot;í°€\u0000&quot;
-converter.testString = &quot;í°€\u0000&quot;
</del><ins>+PASS converter.testString is &quot;\ud800\u0000&quot;
+converter.testUSVString = &quot;\udc00\u0000&quot;
+converter.testString = &quot;\udc00\u0000&quot;
</ins><span class="cx"> PASS converter.testUSVString is &quot;�\u0000&quot;
</span><del>-PASS converter.testString is &quot;í°€\u0000&quot;
-converter.testUSVString = &quot;í°€í €&quot;
-converter.testString = &quot;í°€í €&quot;
</del><ins>+PASS converter.testString is &quot;\udc00\u0000&quot;
+converter.testUSVString = &quot;\udc00\ud800&quot;
+converter.testString = &quot;\udc00\ud800&quot;
</ins><span class="cx"> PASS converter.testUSVString is &quot;��&quot;
</span><del>-PASS converter.testString is &quot;í°€í €&quot;
</del><ins>+PASS converter.testString is &quot;\udc00\ud800&quot;
</ins><span class="cx"> converter.testUSVString = &quot;𝄞&quot;
</span><span class="cx"> converter.testString = &quot;𝄞&quot;
</span><span class="cx"> PASS converter.testUSVString is &quot;𝄞&quot;
</span></span></pre></div>
<a id="trunkLayoutTestsjsresourcesjson2es5compatjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/resources/json2-es5-compat.js \
(239536 => 239537)</h4> <pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/resources/json2-es5-compat.js	2018-12-22 \
                06:39:23 UTC (rev 239536)
+++ trunk/LayoutTests/js/resources/json2-es5-compat.js	2018-12-22 06:41:03 UTC (rev \
239537) </span><span class="lines">@@ -182,7 +182,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     var cx = \
/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
 </span><del>-        escapable = /[\\\&quot;\x00-\x1f]/g,
</del><ins>+        escapable = /[\\\&quot;\x00-\x1f\ud800-\udbff\udc00-\udfff]/g,
</ins><span class="cx">         gap,
</span><span class="cx">         indent,
</span><span class="cx">         meta = {    // table of character substitutions
</span><span class="lines">@@ -196,7 +196,19 @@
</span><span class="cx">         },
</span><span class="cx">         rep;
</span><span class="cx"> 
</span><ins>+    function isHighSurrogate(code) {
+        return code &gt;= 0xd800 &amp;&amp; code &lt;= 0xdbff;
+    }
</ins><span class="cx"> 
</span><ins>+    function isLowSurrogate(code) {
+        return code &gt;= 0xdc00 &amp;&amp; code &lt;= 0xdfff;
+    }
+
+    function isSurrogate(code) {
+        return isHighSurrogate(code) || isLowSurrogate(code);
+    }
+
+
</ins><span class="cx">     function quote(string) {
</span><span class="cx"> 
</span><span class="cx"> // If the string contains no control characters, no quote \
characters, and no </span><span class="lines">@@ -206,10 +218,21 @@
</span><span class="cx"> 
</span><span class="cx">         escapable.lastIndex = 0;
</span><span class="cx">         return escapable.test(string) ?
</span><del>-            '&quot;' + string.replace(escapable, function (a) {
</del><ins>+            '&quot;' + string.replace(escapable, function (a, offset) {
</ins><span class="cx">                 var c = meta[a];
</span><del>-                return typeof c === 'string' ? c :
-                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
</del><ins>+                if (typeof c === 'string')
+                    return c;
+                var code = a.charCodeAt(0);
+                if (!isSurrogate(code))
+                    return '\\u' + ('0000' + \
a.charCodeAt(0).toString(16)).slice(-4); +
+                if (isLowSurrogate(code) &amp;&amp; (offset - 1) &gt;= 0 &amp;&amp; \
isHighSurrogate(string.charCodeAt(offset - 1))) +                    return a;
+
+                if (isHighSurrogate(code) &amp;&amp; (offset + 1) &lt; string.length \
&amp;&amp; isLowSurrogate(string.charCodeAt(offset + 1))) +                    return \
a; +
+                return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
</ins><span class="cx">             }) + '&quot;' :
</span><span class="cx">             '&quot;' + string + '&quot;';
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (239536 => 239537)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog	2018-12-22 06:39:23 UTC (rev \
                239536)
+++ trunk/Source/WTF/ChangeLog	2018-12-22 06:41:03 UTC (rev 239537)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2018-12-20  Yusuke Suzuki  &lt;yusukesuzuki@slowstart.org&gt;
+
+        [JSC] Implement &quot;well-formed JSON.stringify&quot; proposal
+        https://bugs.webkit.org/show_bug.cgi?id=191677
+
+        Reviewed by Darin Adler.
+
+        This patch implements &quot;well-formed JSON.stringify&quot; proposal[1], \
which is now stage 3. +        JSON.stringify appended surrogate pair codes even if \
it is not paired appropriately. +        The proposal requires that broken surrogate \
pairs are unicode-escaped. +
+        [1]: https://github.com/tc39/proposal-well-formed-stringify
+
+        * wtf/text/StringBuilderJSON.cpp:
+        (WTF::appendQuotedJSONStringInternal):
+
</ins><span class="cx"> 2018-12-21  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Expand use of sourceApplicationAuditData
</span></span></pre></div>
<a id="trunkSourceWTFwtftextStringBuilderJSONcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/StringBuilderJSON.cpp \
(239536 => 239537)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/StringBuilderJSON.cpp	2018-12-22 \
                06:39:23 UTC (rev 239536)
+++ trunk/Source/WTF/wtf/text/StringBuilderJSON.cpp	2018-12-22 06:41:03 UTC (rev \
239537) </span><span class="lines">@@ -57,20 +57,47 @@
</span><span class="cx"> {
</span><span class="cx">     for (auto* end = input + length; input != end; ++input) \
{ </span><span class="cx">         auto character = *input;
</span><del>-        auto escaped = escapedFormsForJSON[character &amp; 0xFF];
-        if (LIKELY(!escaped || character &gt; 0xFF)) {
</del><ins>+        if (LIKELY(character &lt;= 0xFF)) {
+            auto escaped = escapedFormsForJSON[character];
+            if (LIKELY(!escaped)) {
+                *output++ = character;
+                continue;
+            }
+
+            *output++ = '\\';
+            *output++ = escaped;
+            if (UNLIKELY(escaped == 'u')) {
+                *output++ = '0';
+                *output++ = '0';
+                *output++ = upperNibbleToLowercaseASCIIHexDigit(character);
+                *output++ = lowerNibbleToLowercaseASCIIHexDigit(character);
+            }
+            continue;
+        }
+
+        if (LIKELY(!U16_IS_SURROGATE(character))) {
</ins><span class="cx">             *output++ = character;
</span><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        auto next = input + 1;
+        bool isValidSurrogatePair = U16_IS_SURROGATE_LEAD(character) &amp;&amp; next \
!= end &amp;&amp; U16_IS_TRAIL(*next); +        if (isValidSurrogatePair) {
+            *output++ = character;
+            *output++ = *next;
+            ++input;
+            continue;
+        }
+
+        uint8_t upper = static_cast&lt;uint32_t&gt;(character) &gt;&gt; 8;
+        uint8_t lower = static_cast&lt;uint8_t&gt;(character);
</ins><span class="cx">         *output++ = '\\';
</span><del>-        *output++ = escaped;
-        if (UNLIKELY(escaped == 'u')) {
-            *output++ = '0';
-            *output++ = '0';
-            *output++ = upperNibbleToLowercaseASCIIHexDigit(character);
-            *output++ = lowerNibbleToLowercaseASCIIHexDigit(character);
-        }
</del><ins>+        *output++ = 'u';
+        *output++ = upperNibbleToLowercaseASCIIHexDigit(upper);
+        *output++ = lowerNibbleToLowercaseASCIIHexDigit(upper);
+        *output++ = upperNibbleToLowercaseASCIIHexDigit(lower);
+        *output++ = lowerNibbleToLowercaseASCIIHexDigit(lower);
+        continue;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>



_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic