Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Issue 2379333003: UTF-16 Decoder: Convert unpaired surrogates to replacement characters (Closed)

Created:
4 years, 2 months ago by jsbell
Modified:
4 years, 2 months ago
CC:
chromium-reviews, blink-reviews-w3ctests_chromium.org, tfarina, blink-reviews, blink-reviews-wtf_chromium.org, jshin+watch_chromium.org, Mikhail
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

UTF-16 Decoder: Convert unpaired surrogates to replacement characters The decoder blithely passed any old 16-bit code unit through, in violation of the Encoding standard. Surrogate pairs should go through unscathed: [ ... 0xD800 0xDC00 ... ] => [ ... U+D800 U+DC00 ... ] But cases like these should result in replacement characters: [ ... 0xD800 ... ] => [ ... U+FFFD ... ] [ ... 0xDC00 ... ] => [ ... U+FFFD ... ] [ ... 0xDC00 0xD800 ... ] => [ ... U+FFFD U+FFFD ... ] This aligns Chrome's behavior with Firefox and Edge. Note that flushing at the end of a stream remains a special case. Streams terminating in the above sequences will not get replacements emitted (current behavior). In addition, a lead surrogate appearing at the end of a stream will now not be emitted, matching other browsers. BUG=368904 R=jshin@chromium.org,foolip@chromium.org Committed: https://crrev.com/9158f6d5f23e54cbce3748539c68cbfdce218bd4 Cr-Commit-Position: refs/heads/master@{#422929}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Hoist DCHECK out of block #

Patch Set 3 : Rebase, switch test to testharness #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -70 lines) Patch
M third_party/WebKit/LayoutTests/fast/encoding/char-decoding-truncated.html View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/encoding/utf-16-lone-surrogates.html View 1 2 1 chunk +21 lines, -0 lines 0 comments Download
D third_party/WebKit/LayoutTests/imported/wpt/encoding/textdecoder-utf16-surrogates-expected.txt View 1 chunk +0 lines, -23 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/TextCodecUTF16.h View 1 2 2 chunks +5 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/TextCodecUTF16.cpp View 1 2 1 chunk +54 lines, -39 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 17 (9 generated)
jsbell
jshin@, foolip@ - please take a look? This is less risky than another approach (https://codereview.chromium.org/1366433005/) ...
4 years, 2 months ago (2016-09-30 21:35:13 UTC) #4
foolip
Will defer to jungshik, but lgtm given my unfamiliarity with the code. https://codereview.chromium.org/2379333003/diff/1/third_party/WebKit/LayoutTests/fast/encoding/utf-16-lone-surrogates.html File third_party/WebKit/LayoutTests/fast/encoding/utf-16-lone-surrogates.html ...
4 years, 2 months ago (2016-09-30 22:59:41 UTC) #7
jsbell
https://codereview.chromium.org/2379333003/diff/1/third_party/WebKit/LayoutTests/fast/encoding/utf-16-lone-surrogates.html File third_party/WebKit/LayoutTests/fast/encoding/utf-16-lone-surrogates.html (right): https://codereview.chromium.org/2379333003/diff/1/third_party/WebKit/LayoutTests/fast/encoding/utf-16-lone-surrogates.html#newcode6 third_party/WebKit/LayoutTests/fast/encoding/utf-16-lone-surrogates.html:6: description("Test encoding behavior for lone UTF-16 surrogates"); On 2016/09/30 ...
4 years, 2 months ago (2016-09-30 23:52:13 UTC) #8
jungshik at Google
LGTM ! Thanks
4 years, 2 months ago (2016-10-04 17:32:02 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2379333003/40001
4 years, 2 months ago (2016-10-04 19:03:45 UTC) #12
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 2 months ago (2016-10-04 21:05:47 UTC) #14
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/9158f6d5f23e54cbce3748539c68cbfdce218bd4 Cr-Commit-Position: refs/heads/master@{#422929}
4 years, 2 months ago (2016-10-04 21:09:24 UTC) #16
jsbell
4 years, 2 months ago (2016-10-04 21:37:20 UTC) #17
Message was sent while issue was closed.
** Future Perf Sheriffs! **

If this regresses perf, just go ahead and revert.

I've got a few tricks I can try if necessary, but I'd prefer we revert and show
that we've cleanly recovered from the regression rather than iterating.

Powered by Google App Engine
This is Rietveld 408576698