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

Issue 2629573002: Allow WebString.utf8() to take UTF8ConversionMode (Closed)

Created:
3 years, 11 months ago by kinuko
Modified:
3 years, 11 months ago
CC:
blink-reviews, blink-reviews-api_chromium.org, blink-reviews-wtf_chromium.org, chromium-reviews, dcheng, dglazkov+blink, kinuko+watch, Mikhail
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Allow WebString.utf8() to take UTF8ConversionMode Currently WebString.utf8() always converts the internal string to UTF-8 with LenientUTF8Conversion mode (if the string is not ascii), but WebString::fromUTF8() only takes valid, strict UTF-8 string. therefore the same string may not be able to be converted back to WebString. This has been causing a few issues: - UTF16 (WTFString) -> UTF8 -> UTF16 (WTFString) round trip doesn't work - Works differently from base::UTF16ToUTF8, and some code explicitly calls base version via .utf16() to avoid any problems while it could be more costly than .utf8() if the internal string is ascii/latin. Similar but opposite attempt has been made in the past in https://codereview.chromium.org/1768063002/ but hadn't landed as leniently converted UTF8 is not valid and probably should not be accepted. BUG=667131 Review-Url: https://codereview.chromium.org/2629573002 Cr-Commit-Position: refs/heads/master@{#444008} Committed: https://chromium.googlesource.com/chromium/src/+/d280d3b7b888a5f8964e916cdc2360ebc7858418

Patch Set 1 : (no tests yet) #

Patch Set 2 : fix #

Total comments: 2

Patch Set 3 : addressed comments, +tests #

Patch Set 4 : +tests, really #

Patch Set 5 : . #

Patch Set 6 : comment fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+87 lines, -5 lines) Patch
M third_party/WebKit/Source/platform/BUILD.gn View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/exported/WebString.cpp View 1 2 3 4 2 chunks +15 lines, -2 lines 0 comments Download
A third_party/WebKit/Source/platform/exported/WebStringTest.cpp View 1 2 3 4 5 1 chunk +50 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/StringUTF8Adaptor.h View 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/public/platform/WebString.h View 1 2 3 4 3 chunks +17 lines, -1 line 0 comments Download

Messages

Total messages: 42 (35 generated)
kinuko
For the people who tried similar (but in a opposite way) before: what do you ...
3 years, 11 months ago (2017-01-13 07:34:40 UTC) #16
jochen (gone - plz use gerrit)
lgtm https://codereview.chromium.org/2629573002/diff/40001/third_party/WebKit/public/platform/WebString.h File third_party/WebKit/public/platform/WebString.h (right): https://codereview.chromium.org/2629573002/diff/40001/third_party/WebKit/public/platform/WebString.h#newcode82 third_party/WebKit/public/platform/WebString.h:82: enum UTF8ConversionMode { nit. why not an enum ...
3 years, 11 months ago (2017-01-13 08:42:31 UTC) #17
kinuko
Thanks! Addressed comments & added tests. Will be landing (feel free to uncheck CQ if ...
3 years, 11 months ago (2017-01-17 07:15:49 UTC) #33
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/2629573002/140001
3 years, 11 months ago (2017-01-17 07:16:05 UTC) #36
commit-bot: I haz the power
Committed patchset #6 (id:140001) as https://chromium.googlesource.com/chromium/src/+/d280d3b7b888a5f8964e916cdc2360ebc7858418
3 years, 11 months ago (2017-01-17 09:09:25 UTC) #39
esprehn
In the future let's add some usage of the new API at the same time ...
3 years, 11 months ago (2017-01-17 10:43:26 UTC) #41
kinuko
3 years, 11 months ago (2017-01-17 14:43:02 UTC) #42
Message was sent while issue was closed.
On 2017/01/17 10:43:26, esprehn wrote:
> In the future let's add some usage of the new API at the same time (one usage
is
> fine). This adds a bunch of new API surface but it's not clear where it'll get
> used.

Yep sure, will do so.  (I'm going to use the new utf8 mode in
https://codereview.chromium.org/2613003002/)

Powered by Google App Engine
This is Rietveld 408576698