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

Issue 1768063002: Introduce String::fromUTF8Lenient() and use it for cache_name in CacheStorage API. (Closed)

Created:
4 years, 9 months ago by horo
Modified:
4 years, 6 months ago
CC:
blink-reviews, blink-reviews-api_chromium.org, blink-reviews-wtf_chromium.org, chromium-reviews, darin-cc_chromium.org, dglazkov+blink, jam, jkarlin+watch_chromium.org, kinuko+watch, Mikhail, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, nhiroki
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce String::fromUTF8Lenient() and use it for cache_name in CacheStorage API. LenientUTF8Conversion mode of WTF::String::utf8() converts a unpaired surrogate to the value of [EDA080-EDAFBF] and [EDB080-EDBFBF]. But current WTF::String::fromUTF8() doesn't support those values. This cl introduce fromUTF8Lenient() which supports the unpaired surrogates. And use WebString::fromUTF8Lenient() in CacheStorage API to fix https://crbug.com/432746 BUG=432746

Patch Set 1 : #

Total comments: 8

Patch Set 2 : incorporated jsbell's comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+127 lines, -43 lines) Patch
M content/browser/cache_storage/cache_storage_dispatcher_host.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M content/browser/cache_storage/cache_storage_dispatcher_host.cc View 1 8 chunks +8 lines, -15 lines 0 comments Download
M content/common/cache_storage/cache_storage_messages.h View 2 chunks +4 lines, -4 lines 0 comments Download
M content/common/cache_storage/cache_storage_types.h View 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/cache_storage/cache_storage_dispatcher.h View 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/cache_storage/cache_storage_dispatcher.cc View 5 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/cachestorage/serviceworker/cache-storage-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/cachestorage/window/cache-storage-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/cachestorage/worker/cache-storage-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/exported/WebString.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/UTF8.cpp View 4 chunks +6 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFString.h View 1 2 chunks +8 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFString.cpp View 1 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/wtf/text/WTFStringTest.cpp View 1 2 chunks +73 lines, -0 lines 0 comments Download
M third_party/WebKit/public/platform/WebString.h View 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 34 (12 generated)
horo
jkarlin@ Could you please review this?
4 years, 9 months ago (2016-03-07 08:57:07 UTC) #8
jkarlin
Code looks good, thanks for doing this. We're going to lose existing caches that contain ...
4 years, 9 months ago (2016-03-07 14:37:43 UTC) #9
horo
On 2016/03/07 14:37:43, jkarlin wrote: > Code looks good, thanks for doing this. > > ...
4 years, 9 months ago (2016-03-08 01:44:52 UTC) #10
jkarlin
On 2016/03/08 01:44:52, horo wrote: > On 2016/03/07 14:37:43, jkarlin wrote: > > Code looks ...
4 years, 9 months ago (2016-03-08 12:16:45 UTC) #11
horo
jochen@ Could you please review third_party/WebKit/Source/*?
4 years, 9 months ago (2016-03-08 13:11:21 UTC) #13
horo
On 2016/03/08 13:11:21, horo wrote: > jochen@ > Could you please review third_party/WebKit/Source/*? And third_party/WebKit/public/platform/WebString.h.
4 years, 9 months ago (2016-03-08 13:11:47 UTC) #14
johnme
Drive-by: it's not clear this fully fixes https://crbug.com/432746. String::utf8() and fromUTF8Lenient() are backed by convertUTF8ToUTF16 ...
4 years, 9 months ago (2016-03-08 14:17:51 UTC) #16
jkarlin
On 2016/03/08 14:17:51, johnme wrote: > Drive-by: it's not clear this fully fixes https://crbug.com/432746. > ...
4 years, 9 months ago (2016-03-08 15:29:22 UTC) #17
jkarlin
On 2016/03/08 15:29:22, jkarlin wrote: > On 2016/03/08 14:17:51, johnme wrote: > > Drive-by: it's ...
4 years, 9 months ago (2016-03-08 15:34:08 UTC) #18
jkarlin
On 2016/03/08 15:34:08, jkarlin wrote: > On 2016/03/08 15:29:22, jkarlin wrote: > > On 2016/03/08 ...
4 years, 9 months ago (2016-03-08 17:48:41 UTC) #19
johnme
On 2016/03/08 17:48:41, jkarlin wrote: > On 2016/03/08 15:34:08, jkarlin wrote: > > On 2016/03/08 ...
4 years, 9 months ago (2016-03-08 18:13:48 UTC) #20
jkarlin
On 2016/03/08 18:13:48, johnme wrote: > On 2016/03/08 17:48:41, jkarlin wrote: > > On 2016/03/08 ...
4 years, 9 months ago (2016-03-08 19:33:12 UTC) #21
jkarlin
dominicc: Can you chime in on this discussion? Is it safe to go from DOMString ...
4 years, 9 months ago (2016-03-08 19:35:02 UTC) #23
jsbell
On 2016/03/08 19:35:02, jkarlin wrote: > dominicc: Can you chime in on this discussion? Is ...
4 years, 9 months ago (2016-03-08 20:12:10 UTC) #24
jsbell
On 2016/03/08 19:35:02, jkarlin wrote: > dominicc: Can you chime in on this discussion? Is ...
4 years, 9 months ago (2016-03-08 20:15:57 UTC) #25
jsbell
https://codereview.chromium.org/1768063002/diff/20001/third_party/WebKit/Source/wtf/text/WTFString.h File third_party/WebKit/Source/wtf/text/WTFString.h (right): https://codereview.chromium.org/1768063002/diff/20001/third_party/WebKit/Source/wtf/text/WTFString.h#newcode433 third_party/WebKit/Source/wtf/text/WTFString.h:433: static String fromUTF8(const LChar*, size_t, bool strict = true); ...
4 years, 9 months ago (2016-03-08 20:28:15 UTC) #27
horo
https://codereview.chromium.org/1768063002/diff/20001/third_party/WebKit/Source/wtf/text/WTFString.h File third_party/WebKit/Source/wtf/text/WTFString.h (right): https://codereview.chromium.org/1768063002/diff/20001/third_party/WebKit/Source/wtf/text/WTFString.h#newcode433 third_party/WebKit/Source/wtf/text/WTFString.h:433: static String fromUTF8(const LChar*, size_t, bool strict = true); ...
4 years, 9 months ago (2016-03-09 01:58:41 UTC) #28
jochen (gone - plz use gerrit)
unpaired surrogates are not valid utf8, they should be replaced by 0xFFFD
4 years, 9 months ago (2016-03-09 15:13:27 UTC) #29
jochen (gone - plz use gerrit)
i see that there's already some discussion about roundtrips going on. However, I don't think ...
4 years, 9 months ago (2016-03-09 15:21:28 UTC) #30
jsbell
Updated tests lgtm, but we should satisfy jochen's concern. Given that WebString's conversion is lenient ...
4 years, 9 months ago (2016-03-09 16:47:41 UTC) #31
jochen (gone - plz use gerrit)
also note that all code paths that go through UTF8Encoding().encode() already replace unmatched surrogate pairs ...
4 years, 9 months ago (2016-03-10 12:26:15 UTC) #32
jsbell
4 years, 9 months ago (2016-03-10 17:16:47 UTC) #33
Hilariously relevant: 

https://simonsapin.github.io/wtf-8/

(and by extension, DOMStrings could be said to be 'WTF-16')

Powered by Google App Engine
This is Rietveld 408576698