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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/RequestInit.cpp

Issue 1998563002: Fix URLSearchParams to use the right encoding algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/fetch/RequestInit.h" 5 #include "modules/fetch/RequestInit.h"
6 6
7 #include "bindings/core/v8/Dictionary.h" 7 #include "bindings/core/v8/Dictionary.h"
8 #include "bindings/core/v8/V8ArrayBuffer.h" 8 #include "bindings/core/v8/V8ArrayBuffer.h"
9 #include "bindings/core/v8/V8ArrayBufferView.h" 9 #include "bindings/core/v8/V8ArrayBufferView.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 RefPtr<BlobDataHandle> blobDataHandle = V8Blob::toImpl(v8::Local<v8::Obj ect>::Cast(v8Body))->blobDataHandle(); 117 RefPtr<BlobDataHandle> blobDataHandle = V8Blob::toImpl(v8::Local<v8::Obj ect>::Cast(v8Body))->blobDataHandle();
118 contentType = blobDataHandle->type(); 118 contentType = blobDataHandle->type();
119 body = FetchBlobDataConsumerHandle::create(context, blobDataHandle.relea se()); 119 body = FetchBlobDataConsumerHandle::create(context, blobDataHandle.relea se());
120 } else if (V8FormData::hasInstance(v8Body, isolate)) { 120 } else if (V8FormData::hasInstance(v8Body, isolate)) {
121 RefPtr<EncodedFormData> formData = V8FormData::toImpl(v8::Local<v8::Obje ct>::Cast(v8Body))->encodeMultiPartFormData(); 121 RefPtr<EncodedFormData> formData = V8FormData::toImpl(v8::Local<v8::Obje ct>::Cast(v8Body))->encodeMultiPartFormData();
122 // Here we handle formData->boundary() as a C-style string. See 122 // Here we handle formData->boundary() as a C-style string. See
123 // FormDataEncoder::generateUniqueBoundaryString. 123 // FormDataEncoder::generateUniqueBoundaryString.
124 contentType = AtomicString("multipart/form-data; boundary=") + formData- >boundary().data(); 124 contentType = AtomicString("multipart/form-data; boundary=") + formData- >boundary().data();
125 body = FetchFormDataConsumerHandle::create(context, formData.release()); 125 body = FetchFormDataConsumerHandle::create(context, formData.release());
126 } else if (V8URLSearchParams::hasInstance(v8Body, isolate)) { 126 } else if (V8URLSearchParams::hasInstance(v8Body, isolate)) {
127 RefPtr<EncodedFormData> formData = V8URLSearchParams::toImpl(v8::Local<v 8::Object>::Cast(v8Body))->encodeFormData(); 127 RefPtr<EncodedFormData> formData = V8URLSearchParams::toImpl(v8::Local<v 8::Object>::Cast(v8Body))->toEncodedFormData();
128 contentType = AtomicString("application/x-www-form-urlencoded;charset=UT F-8"); 128 contentType = AtomicString("application/x-www-form-urlencoded;charset=UT F-8");
129 body = FetchFormDataConsumerHandle::create(context, formData.release()); 129 body = FetchFormDataConsumerHandle::create(context, formData.release());
130 } else if (v8Body->IsString()) { 130 } else if (v8Body->IsString()) {
131 contentType = "text/plain;charset=UTF-8"; 131 contentType = "text/plain;charset=UTF-8";
132 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState)); 132 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState));
133 } 133 }
134 } 134 }
135 135
136 } // namespace blink 136 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698