Commit b322a223 authored by Eero Häkkinen's avatar Eero Häkkinen Committed by Commit Bot

Rename named UTF-8 decode constructors in TextResourceDecoderOptions

This CL renames CreateAlwaysUseUTF8ForText to CreateUTF8Decode and
CreateAlwaysUseUTF8WithoutBOMForText to CreateUTF8DecodeWithoutBOM in
TextResourceDecoderOptions. This is to make it easier to distinguish
these two named constructors, to match with the spec names and to
shorten the names.

Bug: 796192
Change-Id: Ib3ee204b1e0c81a95ab0ca58f47def892525984e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893260
Commit-Queue: Eero Häkkinen <eero.hakkinen@intel.com>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarBen Kelly <wanderview@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711659}
parent 2a641e8a
...@@ -259,8 +259,7 @@ ScriptPromise Body::formData(ScriptState* script_state, ...@@ -259,8 +259,7 @@ ScriptPromise Body::formData(ScriptState* script_state,
// which does not decode BOM. // which does not decode BOM.
BodyBuffer()->StartLoading( BodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString( FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions:: TextResourceDecoderOptions::CreateUTF8DecodeWithoutBOM()),
CreateAlwaysUseUTF8WithoutBOMForText()),
MakeGarbageCollected<BodyFormDataConsumer>(resolver), MakeGarbageCollected<BodyFormDataConsumer>(resolver),
exception_state); exception_state);
if (exception_state.HadException()) { if (exception_state.HadException()) {
...@@ -307,7 +306,7 @@ ScriptPromise Body::json(ScriptState* script_state, ...@@ -307,7 +306,7 @@ ScriptPromise Body::json(ScriptState* script_state,
if (BodyBuffer()) { if (BodyBuffer()) {
BodyBuffer()->StartLoading( BodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString( FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()), TextResourceDecoderOptions::CreateUTF8Decode()),
MakeGarbageCollected<BodyJsonConsumer>(resolver), exception_state); MakeGarbageCollected<BodyJsonConsumer>(resolver), exception_state);
if (exception_state.HadException()) { if (exception_state.HadException()) {
// Need to resolve the ScriptPromiseResolver to avoid a DCHECK(). // Need to resolve the ScriptPromiseResolver to avoid a DCHECK().
...@@ -336,7 +335,7 @@ ScriptPromise Body::text(ScriptState* script_state, ...@@ -336,7 +335,7 @@ ScriptPromise Body::text(ScriptState* script_state,
if (BodyBuffer()) { if (BodyBuffer()) {
BodyBuffer()->StartLoading( BodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString( FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()), TextResourceDecoderOptions::CreateUTF8Decode()),
MakeGarbageCollected<BodyTextConsumer>(resolver), exception_state); MakeGarbageCollected<BodyTextConsumer>(resolver), exception_state);
if (exception_state.HadException()) { if (exception_state.HadException()) {
// Need to resolve the ScriptPromiseResolver to avoid a DCHECK(). // Need to resolve the ScriptPromiseResolver to avoid a DCHECK().
......
...@@ -126,17 +126,15 @@ TEST_F(BodyStreamBufferTest, Tee) { ...@@ -126,17 +126,15 @@ TEST_F(BodyStreamBufferTest, Tee) {
EXPECT_FALSE(buffer->HasPendingActivity()); EXPECT_FALSE(buffer->HasPendingActivity());
checkpoint.Call(0); checkpoint.Call(0);
new1->StartLoading( new1->StartLoading(FetchDataLoader::CreateLoaderAsString(
FetchDataLoader::CreateLoaderAsString( TextResourceDecoderOptions::CreateUTF8Decode()),
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client1, exception_state); client1, exception_state);
checkpoint.Call(1); checkpoint.Call(1);
test::RunPendingTasks(); test::RunPendingTasks();
checkpoint.Call(2); checkpoint.Call(2);
new2->StartLoading( new2->StartLoading(FetchDataLoader::CreateLoaderAsString(
FetchDataLoader::CreateLoaderAsString( TextResourceDecoderOptions::CreateUTF8Decode()),
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client2, exception_state); client2, exception_state);
checkpoint.Call(3); checkpoint.Call(3);
test::RunPendingTasks(); test::RunPendingTasks();
...@@ -199,17 +197,15 @@ TEST_F(BodyStreamBufferTest, TeeFromHandleMadeFromStream) { ...@@ -199,17 +197,15 @@ TEST_F(BodyStreamBufferTest, TeeFromHandleMadeFromStream) {
EXPECT_TRUE(buffer->IsStreamDisturbed(exception_state).value_or(false)); EXPECT_TRUE(buffer->IsStreamDisturbed(exception_state).value_or(false));
EXPECT_FALSE(buffer->HasPendingActivity()); EXPECT_FALSE(buffer->HasPendingActivity());
new1->StartLoading( new1->StartLoading(FetchDataLoader::CreateLoaderAsString(
FetchDataLoader::CreateLoaderAsString( TextResourceDecoderOptions::CreateUTF8Decode()),
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client1, exception_state); client1, exception_state);
checkpoint.Call(1); checkpoint.Call(1);
test::RunPendingTasks(); test::RunPendingTasks();
checkpoint.Call(2); checkpoint.Call(2);
new2->StartLoading( new2->StartLoading(FetchDataLoader::CreateLoaderAsString(
FetchDataLoader::CreateLoaderAsString( TextResourceDecoderOptions::CreateUTF8Decode()),
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client2, exception_state); client2, exception_state);
checkpoint.Call(3); checkpoint.Call(3);
test::RunPendingTasks(); test::RunPendingTasks();
...@@ -448,9 +444,8 @@ TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsString) { ...@@ -448,9 +444,8 @@ TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsString) {
src->Add(Command(Command::kDone)); src->Add(Command(Command::kDone));
BodyStreamBuffer* buffer = MakeGarbageCollected<BodyStreamBuffer>( BodyStreamBuffer* buffer = MakeGarbageCollected<BodyStreamBuffer>(
scope.GetScriptState(), src, nullptr); scope.GetScriptState(), src, nullptr);
buffer->StartLoading( buffer->StartLoading(FetchDataLoader::CreateLoaderAsString(
FetchDataLoader::CreateLoaderAsString( TextResourceDecoderOptions::CreateUTF8Decode()),
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client, ASSERT_NO_EXCEPTION); client, ASSERT_NO_EXCEPTION);
EXPECT_TRUE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(false)); EXPECT_TRUE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(false));
...@@ -486,9 +481,8 @@ TEST_F(BodyStreamBufferTest, LoadClosedHandle) { ...@@ -486,9 +481,8 @@ TEST_F(BodyStreamBufferTest, LoadClosedHandle) {
EXPECT_FALSE(buffer->HasPendingActivity()); EXPECT_FALSE(buffer->HasPendingActivity());
checkpoint.Call(1); checkpoint.Call(1);
buffer->StartLoading( buffer->StartLoading(FetchDataLoader::CreateLoaderAsString(
FetchDataLoader::CreateLoaderAsString( TextResourceDecoderOptions::CreateUTF8Decode()),
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client, ASSERT_NO_EXCEPTION); client, ASSERT_NO_EXCEPTION);
checkpoint.Call(2); checkpoint.Call(2);
...@@ -518,9 +512,8 @@ TEST_F(BodyStreamBufferTest, LoadErroredHandle) { ...@@ -518,9 +512,8 @@ TEST_F(BodyStreamBufferTest, LoadErroredHandle) {
EXPECT_FALSE(buffer->HasPendingActivity()); EXPECT_FALSE(buffer->HasPendingActivity());
checkpoint.Call(1); checkpoint.Call(1);
buffer->StartLoading( buffer->StartLoading(FetchDataLoader::CreateLoaderAsString(
FetchDataLoader::CreateLoaderAsString( TextResourceDecoderOptions::CreateUTF8Decode()),
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client, ASSERT_NO_EXCEPTION); client, ASSERT_NO_EXCEPTION);
checkpoint.Call(2); checkpoint.Call(2);
...@@ -546,9 +539,8 @@ TEST_F(BodyStreamBufferTest, LoaderShouldBeKeptAliveByBodyStreamBuffer) { ...@@ -546,9 +539,8 @@ TEST_F(BodyStreamBufferTest, LoaderShouldBeKeptAliveByBodyStreamBuffer) {
src->Add(Command(Command::kDone)); src->Add(Command(Command::kDone));
Persistent<BodyStreamBuffer> buffer = MakeGarbageCollected<BodyStreamBuffer>( Persistent<BodyStreamBuffer> buffer = MakeGarbageCollected<BodyStreamBuffer>(
scope.GetScriptState(), src, nullptr); scope.GetScriptState(), src, nullptr);
buffer->StartLoading( buffer->StartLoading(FetchDataLoader::CreateLoaderAsString(
FetchDataLoader::CreateLoaderAsString( TextResourceDecoderOptions::CreateUTF8Decode()),
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client, ASSERT_NO_EXCEPTION); client, ASSERT_NO_EXCEPTION);
ThreadState::Current()->CollectAllGarbageForTesting(); ThreadState::Current()->CollectAllGarbageForTesting();
......
...@@ -399,7 +399,7 @@ class FetchDataLoaderAsFormData final : public FetchDataLoader, ...@@ -399,7 +399,7 @@ class FetchDataLoaderAsFormData final : public FetchDataLoader,
} else { } else {
if (!string_decoder_) { if (!string_decoder_) {
string_decoder_ = std::make_unique<TextResourceDecoder>( string_decoder_ = std::make_unique<TextResourceDecoder>(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()); TextResourceDecoderOptions::CreateUTF8Decode());
} }
string_builder_.reset(new StringBuilder); string_builder_.reset(new StringBuilder);
} }
......
...@@ -75,8 +75,8 @@ class CORE_EXPORT FetchDataLoader : public GarbageCollected<FetchDataLoader> { ...@@ -75,8 +75,8 @@ class CORE_EXPORT FetchDataLoader : public GarbageCollected<FetchDataLoader> {
static FetchDataLoader* CreateLoaderAsFormData( static FetchDataLoader* CreateLoaderAsFormData(
const String& multipart_boundary); const String& multipart_boundary);
// The text resource decoder options should be created either by // The text resource decoder options should be created either by
// TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText() or // TextResourceDecoderOptions::CreateUTF8Decode() or
// TextResourceDecoderOptions::CreateAlwaysUseUTF8WithoutBOMForText(). // TextResourceDecoderOptions::CreateUTF8DecodeWithoutBOM().
static FetchDataLoader* CreateLoaderAsString( static FetchDataLoader* CreateLoaderAsString(
const TextResourceDecoderOptions&); const TextResourceDecoderOptions&);
// The mojo::DataPipe consumer handle is provided via the // The mojo::DataPipe consumer handle is provided via the
......
...@@ -606,7 +606,7 @@ TEST_F(FetchDataLoaderTest, LoadAsString) { ...@@ -606,7 +606,7 @@ TEST_F(FetchDataLoaderTest, LoadAsString) {
auto* consumer = MakeGarbageCollected<MockBytesConsumer>(); auto* consumer = MakeGarbageCollected<MockBytesConsumer>();
FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString( FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()); TextResourceDecoderOptions::CreateUTF8Decode());
auto* fetch_data_loader_client = auto* fetch_data_loader_client =
MakeGarbageCollected<MockFetchDataLoaderClient>(); MakeGarbageCollected<MockFetchDataLoaderClient>();
...@@ -646,7 +646,7 @@ TEST_F(FetchDataLoaderTest, LoadAsStringWithNullBytes) { ...@@ -646,7 +646,7 @@ TEST_F(FetchDataLoaderTest, LoadAsStringWithNullBytes) {
auto* consumer = MakeGarbageCollected<MockBytesConsumer>(); auto* consumer = MakeGarbageCollected<MockBytesConsumer>();
FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString( FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()); TextResourceDecoderOptions::CreateUTF8Decode());
auto* fetch_data_loader_client = auto* fetch_data_loader_client =
MakeGarbageCollected<MockFetchDataLoaderClient>(); MakeGarbageCollected<MockFetchDataLoaderClient>();
...@@ -687,7 +687,7 @@ TEST_F(FetchDataLoaderTest, LoadAsStringError) { ...@@ -687,7 +687,7 @@ TEST_F(FetchDataLoaderTest, LoadAsStringError) {
auto* consumer = MakeGarbageCollected<MockBytesConsumer>(); auto* consumer = MakeGarbageCollected<MockBytesConsumer>();
FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString( FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()); TextResourceDecoderOptions::CreateUTF8Decode());
auto* fetch_data_loader_client = auto* fetch_data_loader_client =
MakeGarbageCollected<MockFetchDataLoaderClient>(); MakeGarbageCollected<MockFetchDataLoaderClient>();
...@@ -726,7 +726,7 @@ TEST_F(FetchDataLoaderTest, LoadAsStringCancel) { ...@@ -726,7 +726,7 @@ TEST_F(FetchDataLoaderTest, LoadAsStringCancel) {
auto* consumer = MakeGarbageCollected<MockBytesConsumer>(); auto* consumer = MakeGarbageCollected<MockBytesConsumer>();
FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString( FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()); TextResourceDecoderOptions::CreateUTF8Decode());
auto* fetch_data_loader_client = auto* fetch_data_loader_client =
MakeGarbageCollected<MockFetchDataLoaderClient>(); MakeGarbageCollected<MockFetchDataLoaderClient>();
......
...@@ -83,11 +83,11 @@ void CheckResponseStream(ScriptState* script_state, ...@@ -83,11 +83,11 @@ void CheckResponseStream(ScriptState* script_state,
response->InternalBodyBuffer()->StartLoading( response->InternalBodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString( FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()), TextResourceDecoderOptions::CreateUTF8Decode()),
client1, ASSERT_NO_EXCEPTION); client1, ASSERT_NO_EXCEPTION);
cloned_response->InternalBodyBuffer()->StartLoading( cloned_response->InternalBodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString( FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()), TextResourceDecoderOptions::CreateUTF8Decode()),
client2, ASSERT_NO_EXCEPTION); client2, ASSERT_NO_EXCEPTION);
blink::test::RunPendingTasks(); blink::test::RunPendingTasks();
} }
...@@ -188,11 +188,11 @@ TEST(ServiceWorkerResponseTest, BodyStreamBufferCloneError) { ...@@ -188,11 +188,11 @@ TEST(ServiceWorkerResponseTest, BodyStreamBufferCloneError) {
response->InternalBodyBuffer()->StartLoading( response->InternalBodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString( FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()), TextResourceDecoderOptions::CreateUTF8Decode()),
client1, ASSERT_NO_EXCEPTION); client1, ASSERT_NO_EXCEPTION);
cloned_response->InternalBodyBuffer()->StartLoading( cloned_response->InternalBodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString( FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()), TextResourceDecoderOptions::CreateUTF8Decode()),
client2, ASSERT_NO_EXCEPTION); client2, ASSERT_NO_EXCEPTION);
blink::test::RunPendingTasks(); blink::test::RunPendingTasks();
} }
......
...@@ -90,8 +90,7 @@ Resource* PreloadRequest::Start(Document* document) { ...@@ -90,8 +90,7 @@ Resource* PreloadRequest::Start(Document* document) {
if (script_type_ == mojom::ScriptType::kModule) { if (script_type_ == mojom::ScriptType::kModule) {
DCHECK_EQ(resource_type_, ResourceType::kScript); DCHECK_EQ(resource_type_, ResourceType::kScript);
params.SetDecoderOptions( params.SetDecoderOptions(TextResourceDecoderOptions::CreateUTF8Decode());
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText());
} else if (resource_type_ == ResourceType::kScript || } else if (resource_type_ == ResourceType::kScript ||
resource_type_ == ResourceType::kCSSStyleSheet || resource_type_ == ResourceType::kCSSStyleSheet ||
resource_type_ == ResourceType::kImportResource) { resource_type_ == ResourceType::kImportResource) {
......
...@@ -35,7 +35,7 @@ class TextResourceDecoderForFuzzing : public TextResourceDecoder { ...@@ -35,7 +35,7 @@ class TextResourceDecoderForFuzzing : public TextResourceDecoder {
FuzzedEncoding(fuzzed_data)); FuzzedEncoding(fuzzed_data));
case TextResourceDecoderOptions::kAlwaysUseUTF8ForText: case TextResourceDecoderOptions::kAlwaysUseUTF8ForText:
return TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText(); return TextResourceDecoderOptions::CreateUTF8Decode();
} }
} }
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
namespace blink { namespace blink {
TEST(TextResourceDecoderTest, AlwaysUseUTF8) { TEST(TextResourceDecoderTest, UTF8Decode) {
std::unique_ptr<TextResourceDecoder> decoder = std::unique_ptr<TextResourceDecoder> decoder =
std::make_unique<TextResourceDecoder>( std::make_unique<TextResourceDecoder>(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()); TextResourceDecoderOptions::CreateUTF8Decode());
const unsigned char kFooUTF8WithBOM[] = {0xef, 0xbb, 0xbf, 0x66, 0x6f, 0x6f}; const unsigned char kFooUTF8WithBOM[] = {0xef, 0xbb, 0xbf, 0x66, 0x6f, 0x6f};
WTF::String decoded = decoder->Decode( WTF::String decoded = decoder->Decode(
reinterpret_cast<const char*>(kFooUTF8WithBOM), sizeof(kFooUTF8WithBOM)); reinterpret_cast<const char*>(kFooUTF8WithBOM), sizeof(kFooUTF8WithBOM));
...@@ -20,10 +20,10 @@ TEST(TextResourceDecoderTest, AlwaysUseUTF8) { ...@@ -20,10 +20,10 @@ TEST(TextResourceDecoderTest, AlwaysUseUTF8) {
EXPECT_EQ("foo", decoded); EXPECT_EQ("foo", decoded);
} }
TEST(TextResourceDecoderTest, AlwaysUseUTF8WithoutBOM) { TEST(TextResourceDecoderTest, UTF8DecodeWithoutBOM) {
std::unique_ptr<TextResourceDecoder> decoder = std::unique_ptr<TextResourceDecoder> decoder =
std::make_unique<TextResourceDecoder>( std::make_unique<TextResourceDecoder>(
TextResourceDecoderOptions::CreateAlwaysUseUTF8WithoutBOMForText()); TextResourceDecoderOptions::CreateUTF8DecodeWithoutBOM());
const unsigned char kFooUTF8WithBOM[] = {0xef, 0xbb, 0xbf, 0x66, 0x6f, 0x6f}; const unsigned char kFooUTF8WithBOM[] = {0xef, 0xbb, 0xbf, 0x66, 0x6f, 0x6f};
WTF::String decoded = decoder->Decode( WTF::String decoded = decoder->Decode(
reinterpret_cast<const char*>(kFooUTF8WithBOM), sizeof(kFooUTF8WithBOM)); reinterpret_cast<const char*>(kFooUTF8WithBOM), sizeof(kFooUTF8WithBOM));
......
...@@ -204,7 +204,7 @@ void ModuleScriptLoader::FetchInternal( ...@@ -204,7 +204,7 @@ void ModuleScriptLoader::FetchInternal(
// <spec step="12.1">Let source text be the result of UTF-8 decoding // <spec step="12.1">Let source text be the result of UTF-8 decoding
// response's body.</spec> // response's body.</spec>
fetch_params.SetDecoderOptions( fetch_params.SetDecoderOptions(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()); TextResourceDecoderOptions::CreateUTF8Decode());
// <spec step="8">If the caller specified custom steps to perform the fetch, // <spec step="8">If the caller specified custom steps to perform the fetch,
// perform them on request, setting the is top-level flag if the top-level // perform them on request, setting the is top-level flag if the top-level
......
...@@ -477,7 +477,7 @@ class Cache::CodeCacheHandleCallbackForPut final ...@@ -477,7 +477,7 @@ class Cache::CodeCacheHandleCallbackForPut final
// See crbug.com/743311. // See crbug.com/743311.
std::unique_ptr<TextResourceDecoder> text_decoder = std::unique_ptr<TextResourceDecoder> text_decoder =
std::make_unique<TextResourceDecoder>( std::make_unique<TextResourceDecoder>(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()); TextResourceDecoderOptions::CreateUTF8Decode());
return V8CodeCache::GenerateFullCodeCache( return V8CodeCache::GenerateFullCodeCache(
script_state_, script_state_,
......
...@@ -16,15 +16,14 @@ TextResourceDecoderOptions::TextResourceDecoderOptions( ...@@ -16,15 +16,14 @@ TextResourceDecoderOptions::TextResourceDecoderOptions(
nullptr, nullptr,
KURL()) {} KURL()) {}
TextResourceDecoderOptions TextResourceDecoderOptions TextResourceDecoderOptions::CreateUTF8Decode() {
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText() {
return TextResourceDecoderOptions(kAlwaysUseUTF8ForText, kPlainTextContent, return TextResourceDecoderOptions(kAlwaysUseUTF8ForText, kPlainTextContent,
UTF8Encoding(), nullptr, NullURL()); UTF8Encoding(), nullptr, NullURL());
} }
TextResourceDecoderOptions TextResourceDecoderOptions
TextResourceDecoderOptions::CreateAlwaysUseUTF8WithoutBOMForText() { TextResourceDecoderOptions::CreateUTF8DecodeWithoutBOM() {
TextResourceDecoderOptions options = CreateAlwaysUseUTF8ForText(); TextResourceDecoderOptions options = CreateUTF8Decode();
options.no_bom_decoding_ = true; options.no_bom_decoding_ = true;
return options; return options;
} }
......
...@@ -38,11 +38,11 @@ class PLATFORM_EXPORT TextResourceDecoderOptions final { ...@@ -38,11 +38,11 @@ class PLATFORM_EXPORT TextResourceDecoderOptions final {
// Corresponds to utf-8 decode in Encoding spec: // Corresponds to utf-8 decode in Encoding spec:
// https://encoding.spec.whatwg.org/#utf-8-decode. // https://encoding.spec.whatwg.org/#utf-8-decode.
static TextResourceDecoderOptions CreateAlwaysUseUTF8ForText(); static TextResourceDecoderOptions CreateUTF8Decode();
// Corresponds to utf-8 decode without BOM in Encoding spec: // Corresponds to utf-8 decode without BOM in Encoding spec:
// https://encoding.spec.whatwg.org/#utf-8-decode-without-bom. // https://encoding.spec.whatwg.org/#utf-8-decode-without-bom.
static TextResourceDecoderOptions CreateAlwaysUseUTF8WithoutBOMForText(); static TextResourceDecoderOptions CreateUTF8DecodeWithoutBOM();
static TextResourceDecoderOptions CreateWithAutoDetection( static TextResourceDecoderOptions CreateWithAutoDetection(
ContentType, ContentType,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment