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

Unified Diff: third_party/WebKit/Source/wtf/text/WTFString.cpp

Issue 1768063002: Introduce String::fromUTF8Lenient() and use it for cache_name in CacheStorage API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/text/WTFString.cpp
diff --git a/third_party/WebKit/Source/wtf/text/WTFString.cpp b/third_party/WebKit/Source/wtf/text/WTFString.cpp
index b67387516f033f4813df7bf79234e99544ceb1a4..0c943b90ba91221d0c88732a910b47c1cf58a227 100644
--- a/third_party/WebKit/Source/wtf/text/WTFString.cpp
+++ b/third_party/WebKit/Source/wtf/text/WTFString.cpp
@@ -869,7 +869,7 @@ String String::make16BitFrom8BitSource(const LChar* source, size_t length)
return result;
}
-String String::fromUTF8(const LChar* stringStart, size_t length)
+String String::fromUTF8(const LChar* stringStart, size_t length, bool strict)
{
RELEASE_ASSERT(length <= std::numeric_limits<unsigned>::max());
@@ -887,7 +887,7 @@ String String::fromUTF8(const LChar* stringStart, size_t length)
UChar* bufferCurrent = bufferStart;
const char* stringCurrent = reinterpret_cast<const char*>(stringStart);
- if (convertUTF8ToUTF16(&stringCurrent, reinterpret_cast<const char *>(stringStart + length), &bufferCurrent, bufferCurrent + buffer.size()) != conversionOK)
+ if (convertUTF8ToUTF16(&stringCurrent, reinterpret_cast<const char *>(stringStart + length), &bufferCurrent, bufferCurrent + buffer.size(), nullptr, strict) != conversionOK)
return String();
unsigned utf16Length = bufferCurrent - bufferStart;

Powered by Google App Engine
This is Rietveld 408576698