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

Fix BOM handling in urlencoded form data fetching

Request and Response's formData() urlencoded parsing uses "UTF-8 decode
without BOM" which should not strip BOMs.

Bug: 796192
Change-Id: I76491af9a3331268d28375169d2c22dd31b7a4c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1669298
Commit-Queue: Eero Häkkinen <eero.hakkinen@intel.com>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711228}
parent 5f5cb637
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h" #include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h"
#include "third_party/blink/renderer/platform/heap/disallow_new_wrapper.h" #include "third_party/blink/renderer/platform/heap/disallow_new_wrapper.h"
#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h"
#include "third_party/blink/renderer/platform/network/parsed_content_type.h" #include "third_party/blink/renderer/platform/network/parsed_content_type.h"
#include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/functional.h"
...@@ -252,8 +253,14 @@ ScriptPromise Body::formData(ScriptState* script_state, ...@@ -252,8 +253,14 @@ ScriptPromise Body::formData(ScriptState* script_state,
} }
} else if (parsedType == "application/x-www-form-urlencoded") { } else if (parsedType == "application/x-www-form-urlencoded") {
if (BodyBuffer()) { if (BodyBuffer()) {
// According to https://fetch.spec.whatwg.org/#concept-body-package-data
// application/x-www-form-urlencoded FormData bytes are parsed using
// https://url.spec.whatwg.org/#concept-urlencoded-parser
// which does not decode BOM.
BodyBuffer()->StartLoading( BodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString(), FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::
CreateAlwaysUseUTF8WithoutBOMForText()),
MakeGarbageCollected<BodyFormDataConsumer>(resolver), MakeGarbageCollected<BodyFormDataConsumer>(resolver),
exception_state); exception_state);
if (exception_state.HadException()) { if (exception_state.HadException()) {
...@@ -298,9 +305,10 @@ ScriptPromise Body::json(ScriptState* script_state, ...@@ -298,9 +305,10 @@ ScriptPromise Body::json(ScriptState* script_state,
auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state);
ScriptPromise promise = resolver->Promise(); ScriptPromise promise = resolver->Promise();
if (BodyBuffer()) { if (BodyBuffer()) {
BodyBuffer()->StartLoading(FetchDataLoader::CreateLoaderAsString(), BodyBuffer()->StartLoading(
MakeGarbageCollected<BodyJsonConsumer>(resolver), FetchDataLoader::CreateLoaderAsString(
exception_state); TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
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().
resolver->Resolve(); resolver->Resolve();
...@@ -326,9 +334,10 @@ ScriptPromise Body::text(ScriptState* script_state, ...@@ -326,9 +334,10 @@ ScriptPromise Body::text(ScriptState* script_state,
auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state);
ScriptPromise promise = resolver->Promise(); ScriptPromise promise = resolver->Promise();
if (BodyBuffer()) { if (BodyBuffer()) {
BodyBuffer()->StartLoading(FetchDataLoader::CreateLoaderAsString(), BodyBuffer()->StartLoading(
MakeGarbageCollected<BodyTextConsumer>(resolver), FetchDataLoader::CreateLoaderAsString(
exception_state); TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
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().
resolver->Resolve(); resolver->Resolve();
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h"
#include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h"
#include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h" #include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h"
#include "third_party/blink/renderer/platform/network/encoded_form_data.h" #include "third_party/blink/renderer/platform/network/encoded_form_data.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
...@@ -125,14 +126,18 @@ TEST_F(BodyStreamBufferTest, Tee) { ...@@ -125,14 +126,18 @@ TEST_F(BodyStreamBufferTest, Tee) {
EXPECT_FALSE(buffer->HasPendingActivity()); EXPECT_FALSE(buffer->HasPendingActivity());
checkpoint.Call(0); checkpoint.Call(0);
new1->StartLoading(FetchDataLoader::CreateLoaderAsString(), client1, new1->StartLoading(
exception_state); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client1, exception_state);
checkpoint.Call(1); checkpoint.Call(1);
test::RunPendingTasks(); test::RunPendingTasks();
checkpoint.Call(2); checkpoint.Call(2);
new2->StartLoading(FetchDataLoader::CreateLoaderAsString(), client2, new2->StartLoading(
exception_state); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client2, exception_state);
checkpoint.Call(3); checkpoint.Call(3);
test::RunPendingTasks(); test::RunPendingTasks();
checkpoint.Call(4); checkpoint.Call(4);
...@@ -194,14 +199,18 @@ TEST_F(BodyStreamBufferTest, TeeFromHandleMadeFromStream) { ...@@ -194,14 +199,18 @@ 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(FetchDataLoader::CreateLoaderAsString(), client1, new1->StartLoading(
exception_state); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client1, exception_state);
checkpoint.Call(1); checkpoint.Call(1);
test::RunPendingTasks(); test::RunPendingTasks();
checkpoint.Call(2); checkpoint.Call(2);
new2->StartLoading(FetchDataLoader::CreateLoaderAsString(), client2, new2->StartLoading(
exception_state); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client2, exception_state);
checkpoint.Call(3); checkpoint.Call(3);
test::RunPendingTasks(); test::RunPendingTasks();
checkpoint.Call(4); checkpoint.Call(4);
...@@ -439,8 +448,10 @@ TEST_F(BodyStreamBufferTest, LoadBodyStreamBufferAsString) { ...@@ -439,8 +448,10 @@ 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(FetchDataLoader::CreateLoaderAsString(), client, buffer->StartLoading(
ASSERT_NO_EXCEPTION); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client, ASSERT_NO_EXCEPTION);
EXPECT_TRUE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(false)); EXPECT_TRUE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(false));
EXPECT_TRUE(buffer->IsStreamDisturbed(ASSERT_NO_EXCEPTION).value_or(false)); EXPECT_TRUE(buffer->IsStreamDisturbed(ASSERT_NO_EXCEPTION).value_or(false));
...@@ -475,8 +486,10 @@ TEST_F(BodyStreamBufferTest, LoadClosedHandle) { ...@@ -475,8 +486,10 @@ TEST_F(BodyStreamBufferTest, LoadClosedHandle) {
EXPECT_FALSE(buffer->HasPendingActivity()); EXPECT_FALSE(buffer->HasPendingActivity());
checkpoint.Call(1); checkpoint.Call(1);
buffer->StartLoading(FetchDataLoader::CreateLoaderAsString(), client, buffer->StartLoading(
ASSERT_NO_EXCEPTION); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client, ASSERT_NO_EXCEPTION);
checkpoint.Call(2); checkpoint.Call(2);
EXPECT_TRUE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(false)); EXPECT_TRUE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(false));
...@@ -505,8 +518,10 @@ TEST_F(BodyStreamBufferTest, LoadErroredHandle) { ...@@ -505,8 +518,10 @@ TEST_F(BodyStreamBufferTest, LoadErroredHandle) {
EXPECT_FALSE(buffer->HasPendingActivity()); EXPECT_FALSE(buffer->HasPendingActivity());
checkpoint.Call(1); checkpoint.Call(1);
buffer->StartLoading(FetchDataLoader::CreateLoaderAsString(), client, buffer->StartLoading(
ASSERT_NO_EXCEPTION); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client, ASSERT_NO_EXCEPTION);
checkpoint.Call(2); checkpoint.Call(2);
EXPECT_TRUE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(false)); EXPECT_TRUE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(false));
...@@ -531,8 +546,10 @@ TEST_F(BodyStreamBufferTest, LoaderShouldBeKeptAliveByBodyStreamBuffer) { ...@@ -531,8 +546,10 @@ 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(FetchDataLoader::CreateLoaderAsString(), client, buffer->StartLoading(
ASSERT_NO_EXCEPTION); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client, ASSERT_NO_EXCEPTION);
ThreadState::Current()->CollectAllGarbageForTesting(); ThreadState::Current()->CollectAllGarbageForTesting();
checkpoint.Call(1); checkpoint.Call(1);
......
...@@ -458,14 +458,16 @@ class FetchDataLoaderAsString final : public FetchDataLoader, ...@@ -458,14 +458,16 @@ class FetchDataLoaderAsString final : public FetchDataLoader,
USING_GARBAGE_COLLECTED_MIXIN(FetchDataLoaderAsString); USING_GARBAGE_COLLECTED_MIXIN(FetchDataLoaderAsString);
public: public:
explicit FetchDataLoaderAsString(const TextResourceDecoderOptions& options)
: decoder_options_(options) {}
void Start(BytesConsumer* consumer, void Start(BytesConsumer* consumer,
FetchDataLoader::Client* client) override { FetchDataLoader::Client* client) override {
DCHECK(!client_); DCHECK(!client_);
DCHECK(!decoder_); DCHECK(!decoder_);
DCHECK(!consumer_); DCHECK(!consumer_);
client_ = client; client_ = client;
decoder_ = std::make_unique<TextResourceDecoder>( decoder_ = std::make_unique<TextResourceDecoder>(decoder_options_);
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText());
consumer_ = consumer; consumer_ = consumer;
consumer_->SetClient(this); consumer_->SetClient(this);
OnStateChange(); OnStateChange();
...@@ -516,6 +518,7 @@ class FetchDataLoaderAsString final : public FetchDataLoader, ...@@ -516,6 +518,7 @@ class FetchDataLoaderAsString final : public FetchDataLoader,
Member<FetchDataLoader::Client> client_; Member<FetchDataLoader::Client> client_;
std::unique_ptr<TextResourceDecoder> decoder_; std::unique_ptr<TextResourceDecoder> decoder_;
TextResourceDecoderOptions decoder_options_;
StringBuilder builder_; StringBuilder builder_;
}; };
...@@ -683,8 +686,9 @@ FetchDataLoader* FetchDataLoader::CreateLoaderAsFormData( ...@@ -683,8 +686,9 @@ FetchDataLoader* FetchDataLoader::CreateLoaderAsFormData(
return MakeGarbageCollected<FetchDataLoaderAsFormData>(multipartBoundary); return MakeGarbageCollected<FetchDataLoaderAsFormData>(multipartBoundary);
} }
FetchDataLoader* FetchDataLoader::CreateLoaderAsString() { FetchDataLoader* FetchDataLoader::CreateLoaderAsString(
return MakeGarbageCollected<FetchDataLoaderAsString>(); const TextResourceDecoderOptions& options) {
return MakeGarbageCollected<FetchDataLoaderAsString>(options);
} }
FetchDataLoader* FetchDataLoader::CreateLoaderAsDataPipe( FetchDataLoader* FetchDataLoader::CreateLoaderAsDataPipe(
......
...@@ -17,6 +17,7 @@ namespace blink { ...@@ -17,6 +17,7 @@ namespace blink {
class BytesConsumer; class BytesConsumer;
class FormData; class FormData;
class TextResourceDecoderOptions;
// FetchDataLoader subclasses // FetchDataLoader subclasses
// 1. take a BytesConsumer, // 1. take a BytesConsumer,
...@@ -73,7 +74,11 @@ class CORE_EXPORT FetchDataLoader : public GarbageCollected<FetchDataLoader> { ...@@ -73,7 +74,11 @@ class CORE_EXPORT FetchDataLoader : public GarbageCollected<FetchDataLoader> {
static FetchDataLoader* CreateLoaderAsFailure(); static FetchDataLoader* CreateLoaderAsFailure();
static FetchDataLoader* CreateLoaderAsFormData( static FetchDataLoader* CreateLoaderAsFormData(
const String& multipart_boundary); const String& multipart_boundary);
static FetchDataLoader* CreateLoaderAsString(); // The text resource decoder options should be created either by
// TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText() or
// TextResourceDecoderOptions::CreateAlwaysUseUTF8WithoutBOMForText().
static FetchDataLoader* CreateLoaderAsString(
const TextResourceDecoderOptions&);
// The mojo::DataPipe consumer handle is provided via the // The mojo::DataPipe consumer handle is provided via the
// Client::DidFetchStartedDataPipe() callback. // Client::DidFetchStartedDataPipe() callback.
static FetchDataLoader* CreateLoaderAsDataPipe( static FetchDataLoader* CreateLoaderAsDataPipe(
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "third_party/blink/renderer/core/fileapi/blob.h" #include "third_party/blink/renderer/core/fileapi/blob.h"
#include "third_party/blink/renderer/core/html/forms/form_data.h" #include "third_party/blink/renderer/core/html/forms/form_data.h"
#include "third_party/blink/renderer/platform/loader/fetch/data_pipe_bytes_consumer.h" #include "third_party/blink/renderer/platform/loader/fetch/data_pipe_bytes_consumer.h"
#include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h"
#include "third_party/blink/renderer/platform/loader/testing/bytes_consumer_test_reader.h" #include "third_party/blink/renderer/platform/loader/testing/bytes_consumer_test_reader.h"
#include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h" #include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h"
#include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h" #include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h"
...@@ -604,7 +605,8 @@ TEST_F(FetchDataLoaderTest, LoadAsString) { ...@@ -604,7 +605,8 @@ TEST_F(FetchDataLoaderTest, LoadAsString) {
BytesConsumer::Client* client = nullptr; BytesConsumer::Client* client = nullptr;
auto* consumer = MakeGarbageCollected<MockBytesConsumer>(); auto* consumer = MakeGarbageCollected<MockBytesConsumer>();
FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(); FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText());
auto* fetch_data_loader_client = auto* fetch_data_loader_client =
MakeGarbageCollected<MockFetchDataLoaderClient>(); MakeGarbageCollected<MockFetchDataLoaderClient>();
...@@ -643,7 +645,8 @@ TEST_F(FetchDataLoaderTest, LoadAsStringWithNullBytes) { ...@@ -643,7 +645,8 @@ TEST_F(FetchDataLoaderTest, LoadAsStringWithNullBytes) {
BytesConsumer::Client* client = nullptr; BytesConsumer::Client* client = nullptr;
auto* consumer = MakeGarbageCollected<MockBytesConsumer>(); auto* consumer = MakeGarbageCollected<MockBytesConsumer>();
FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(); FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText());
auto* fetch_data_loader_client = auto* fetch_data_loader_client =
MakeGarbageCollected<MockFetchDataLoaderClient>(); MakeGarbageCollected<MockFetchDataLoaderClient>();
...@@ -683,7 +686,8 @@ TEST_F(FetchDataLoaderTest, LoadAsStringError) { ...@@ -683,7 +686,8 @@ TEST_F(FetchDataLoaderTest, LoadAsStringError) {
BytesConsumer::Client* client = nullptr; BytesConsumer::Client* client = nullptr;
auto* consumer = MakeGarbageCollected<MockBytesConsumer>(); auto* consumer = MakeGarbageCollected<MockBytesConsumer>();
FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(); FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText());
auto* fetch_data_loader_client = auto* fetch_data_loader_client =
MakeGarbageCollected<MockFetchDataLoaderClient>(); MakeGarbageCollected<MockFetchDataLoaderClient>();
...@@ -721,7 +725,8 @@ TEST_F(FetchDataLoaderTest, LoadAsStringCancel) { ...@@ -721,7 +725,8 @@ TEST_F(FetchDataLoaderTest, LoadAsStringCancel) {
BytesConsumer::Client* client = nullptr; BytesConsumer::Client* client = nullptr;
auto* consumer = MakeGarbageCollected<MockBytesConsumer>(); auto* consumer = MakeGarbageCollected<MockBytesConsumer>();
FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(); FetchDataLoader* fetch_data_loader = FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText());
auto* fetch_data_loader_client = auto* fetch_data_loader_client =
MakeGarbageCollected<MockFetchDataLoaderClient>(); MakeGarbageCollected<MockFetchDataLoaderClient>();
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h" #include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h"
#include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h"
#include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h" #include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
...@@ -81,9 +82,13 @@ void CheckResponseStream(ScriptState* script_state, ...@@ -81,9 +82,13 @@ void CheckResponseStream(ScriptState* script_state,
EXPECT_CALL(*client2, DidFetchDataLoadedString(String("Hello, world"))); EXPECT_CALL(*client2, DidFetchDataLoadedString(String("Hello, world")));
response->InternalBodyBuffer()->StartLoading( response->InternalBodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString(), client1, ASSERT_NO_EXCEPTION); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client1, ASSERT_NO_EXCEPTION);
cloned_response->InternalBodyBuffer()->StartLoading( cloned_response->InternalBodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString(), client2, ASSERT_NO_EXCEPTION); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client2, ASSERT_NO_EXCEPTION);
blink::test::RunPendingTasks(); blink::test::RunPendingTasks();
} }
...@@ -182,9 +187,13 @@ TEST(ServiceWorkerResponseTest, BodyStreamBufferCloneError) { ...@@ -182,9 +187,13 @@ TEST(ServiceWorkerResponseTest, BodyStreamBufferCloneError) {
EXPECT_CALL(*client2, DidFetchDataLoadFailed()); EXPECT_CALL(*client2, DidFetchDataLoadFailed());
response->InternalBodyBuffer()->StartLoading( response->InternalBodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString(), client1, ASSERT_NO_EXCEPTION); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client1, ASSERT_NO_EXCEPTION);
cloned_response->InternalBodyBuffer()->StartLoading( cloned_response->InternalBodyBuffer()->StartLoading(
FetchDataLoader::CreateLoaderAsString(), client2, ASSERT_NO_EXCEPTION); FetchDataLoader::CreateLoaderAsString(
TextResourceDecoderOptions::CreateAlwaysUseUTF8ForText()),
client2, ASSERT_NO_EXCEPTION);
blink::test::RunPendingTasks(); blink::test::RunPendingTasks();
} }
......
This is a testharness.js-based test.
Found 90 tests; 88 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS URLSearchParams constructed with: test
PASS request.formData() with input: test
PASS response.formData() with input: test
PASS URLSearchParams constructed with: test=
FAIL request.formData() with input: test= assert_array_equals: property 0, expected "test" but got "test"
FAIL response.formData() with input: test= assert_array_equals: property 0, expected "test" but got "test"
PASS URLSearchParams constructed with: %EF%BB%BFtest=%EF%BB%BF
PASS request.formData() with input: %EF%BB%BFtest=%EF%BB%BF
PASS response.formData() with input: %EF%BB%BFtest=%EF%BB%BF
PASS URLSearchParams constructed with: %FE%FF
PASS request.formData() with input: %FE%FF
PASS response.formData() with input: %FE%FF
PASS URLSearchParams constructed with: %FF%FE
PASS request.formData() with input: %FF%FE
PASS response.formData() with input: %FF%FE
PASS URLSearchParams constructed with: †&†=x
PASS request.formData() with input: †&†=x
PASS response.formData() with input: †&†=x
PASS URLSearchParams constructed with: %C2
PASS request.formData() with input: %C2
PASS response.formData() with input: %C2
PASS URLSearchParams constructed with: %C2x
PASS request.formData() with input: %C2x
PASS response.formData() with input: %C2x
PASS URLSearchParams constructed with: _charset_=windows-1252&test=%C2x
PASS request.formData() with input: _charset_=windows-1252&test=%C2x
PASS response.formData() with input: _charset_=windows-1252&test=%C2x
PASS URLSearchParams constructed with:
PASS request.formData() with input:
PASS response.formData() with input:
PASS URLSearchParams constructed with: a
PASS request.formData() with input: a
PASS response.formData() with input: a
PASS URLSearchParams constructed with: a=b
PASS request.formData() with input: a=b
PASS response.formData() with input: a=b
PASS URLSearchParams constructed with: a=
PASS request.formData() with input: a=
PASS response.formData() with input: a=
PASS URLSearchParams constructed with: =b
PASS request.formData() with input: =b
PASS response.formData() with input: =b
PASS URLSearchParams constructed with: &
PASS request.formData() with input: &
PASS response.formData() with input: &
PASS URLSearchParams constructed with: &a
PASS request.formData() with input: &a
PASS response.formData() with input: &a
PASS URLSearchParams constructed with: a&
PASS request.formData() with input: a&
PASS response.formData() with input: a&
PASS URLSearchParams constructed with: a&a
PASS request.formData() with input: a&a
PASS response.formData() with input: a&a
PASS URLSearchParams constructed with: a&b&c
PASS request.formData() with input: a&b&c
PASS response.formData() with input: a&b&c
PASS URLSearchParams constructed with: a=b&c=d
PASS request.formData() with input: a=b&c=d
PASS response.formData() with input: a=b&c=d
PASS URLSearchParams constructed with: a=b&c=d&
PASS request.formData() with input: a=b&c=d&
PASS response.formData() with input: a=b&c=d&
PASS URLSearchParams constructed with: &&&a=b&&&&c=d&
PASS request.formData() with input: &&&a=b&&&&c=d&
PASS response.formData() with input: &&&a=b&&&&c=d&
PASS URLSearchParams constructed with: a=a&a=b&a=c
PASS request.formData() with input: a=a&a=b&a=c
PASS response.formData() with input: a=a&a=b&a=c
PASS URLSearchParams constructed with: a==a
PASS request.formData() with input: a==a
PASS response.formData() with input: a==a
PASS URLSearchParams constructed with: a=a+b+c+d
PASS request.formData() with input: a=a+b+c+d
PASS response.formData() with input: a=a+b+c+d
PASS URLSearchParams constructed with: %=a
PASS request.formData() with input: %=a
PASS response.formData() with input: %=a
PASS URLSearchParams constructed with: %a=a
PASS request.formData() with input: %a=a
PASS response.formData() with input: %a=a
PASS URLSearchParams constructed with: %a_=a
PASS request.formData() with input: %a_=a
PASS response.formData() with input: %a_=a
PASS URLSearchParams constructed with: %61=a
PASS request.formData() with input: %61=a
PASS response.formData() with input: %61=a
PASS URLSearchParams constructed with: %61+%4d%4D=
PASS request.formData() with input: %61+%4d%4D=
PASS response.formData() with input: %61+%4d%4D=
Harness: the test ran to completion.
This is a testharness.js-based test.
Found 90 tests; 88 PASS, 2 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS URLSearchParams constructed with: test
PASS request.formData() with input: test
PASS response.formData() with input: test
PASS URLSearchParams constructed with: test=
FAIL request.formData() with input: test= assert_array_equals: property 0, expected "test" but got "test"
FAIL response.formData() with input: test= assert_array_equals: property 0, expected "test" but got "test"
PASS URLSearchParams constructed with: %EF%BB%BFtest=%EF%BB%BF
PASS request.formData() with input: %EF%BB%BFtest=%EF%BB%BF
PASS response.formData() with input: %EF%BB%BFtest=%EF%BB%BF
PASS URLSearchParams constructed with: %FE%FF
PASS request.formData() with input: %FE%FF
PASS response.formData() with input: %FE%FF
PASS URLSearchParams constructed with: %FF%FE
PASS request.formData() with input: %FF%FE
PASS response.formData() with input: %FF%FE
PASS URLSearchParams constructed with: †&†=x
PASS request.formData() with input: †&†=x
PASS response.formData() with input: †&†=x
PASS URLSearchParams constructed with: %C2
PASS request.formData() with input: %C2
PASS response.formData() with input: %C2
PASS URLSearchParams constructed with: %C2x
PASS request.formData() with input: %C2x
PASS response.formData() with input: %C2x
PASS URLSearchParams constructed with: _charset_=windows-1252&test=%C2x
PASS request.formData() with input: _charset_=windows-1252&test=%C2x
PASS response.formData() with input: _charset_=windows-1252&test=%C2x
PASS URLSearchParams constructed with:
PASS request.formData() with input:
PASS response.formData() with input:
PASS URLSearchParams constructed with: a
PASS request.formData() with input: a
PASS response.formData() with input: a
PASS URLSearchParams constructed with: a=b
PASS request.formData() with input: a=b
PASS response.formData() with input: a=b
PASS URLSearchParams constructed with: a=
PASS request.formData() with input: a=
PASS response.formData() with input: a=
PASS URLSearchParams constructed with: =b
PASS request.formData() with input: =b
PASS response.formData() with input: =b
PASS URLSearchParams constructed with: &
PASS request.formData() with input: &
PASS response.formData() with input: &
PASS URLSearchParams constructed with: &a
PASS request.formData() with input: &a
PASS response.formData() with input: &a
PASS URLSearchParams constructed with: a&
PASS request.formData() with input: a&
PASS response.formData() with input: a&
PASS URLSearchParams constructed with: a&a
PASS request.formData() with input: a&a
PASS response.formData() with input: a&a
PASS URLSearchParams constructed with: a&b&c
PASS request.formData() with input: a&b&c
PASS response.formData() with input: a&b&c
PASS URLSearchParams constructed with: a=b&c=d
PASS request.formData() with input: a=b&c=d
PASS response.formData() with input: a=b&c=d
PASS URLSearchParams constructed with: a=b&c=d&
PASS request.formData() with input: a=b&c=d&
PASS response.formData() with input: a=b&c=d&
PASS URLSearchParams constructed with: &&&a=b&&&&c=d&
PASS request.formData() with input: &&&a=b&&&&c=d&
PASS response.formData() with input: &&&a=b&&&&c=d&
PASS URLSearchParams constructed with: a=a&a=b&a=c
PASS request.formData() with input: a=a&a=b&a=c
PASS response.formData() with input: a=a&a=b&a=c
PASS URLSearchParams constructed with: a==a
PASS request.formData() with input: a==a
PASS response.formData() with input: a==a
PASS URLSearchParams constructed with: a=a+b+c+d
PASS request.formData() with input: a=a+b+c+d
PASS response.formData() with input: a=a+b+c+d
PASS URLSearchParams constructed with: %=a
PASS request.formData() with input: %=a
PASS response.formData() with input: %=a
PASS URLSearchParams constructed with: %a=a
PASS request.formData() with input: %a=a
PASS response.formData() with input: %a=a
PASS URLSearchParams constructed with: %a_=a
PASS request.formData() with input: %a_=a
PASS response.formData() with input: %a_=a
PASS URLSearchParams constructed with: %61=a
PASS request.formData() with input: %61=a
PASS response.formData() with input: %61=a
PASS URLSearchParams constructed with: %61+%4d%4D=
PASS request.formData() with input: %61+%4d%4D=
PASS response.formData() with input: %61+%4d%4D=
Harness: the test ran to completion.
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