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

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

Issue 1476003002: Build content-type string in PasswordCredential::encodeFormData() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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
« no previous file with comments | « third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "modules/fetch/RequestInit.h" 6 #include "modules/fetch/RequestInit.h"
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/V8ArrayBuffer.h" 9 #include "bindings/core/v8/V8ArrayBuffer.h"
10 #include "bindings/core/v8/V8ArrayBufferView.h" 10 #include "bindings/core/v8/V8ArrayBufferView.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } else if (V8URLSearchParams::hasInstance(v8Body, isolate)) { 85 } else if (V8URLSearchParams::hasInstance(v8Body, isolate)) {
86 RefPtr<EncodedFormData> formData = V8URLSearchParams::toImpl(v8::Local<v 8::Object>::Cast(v8Body))->encodeFormData(); 86 RefPtr<EncodedFormData> formData = V8URLSearchParams::toImpl(v8::Local<v 8::Object>::Cast(v8Body))->encodeFormData();
87 contentType = AtomicString("application/x-www-form-urlencoded;charset=UT F-8", AtomicString::ConstructFromLiteral); 87 contentType = AtomicString("application/x-www-form-urlencoded;charset=UT F-8", AtomicString::ConstructFromLiteral);
88 body = FetchFormDataConsumerHandle::create(context, formData.release()); 88 body = FetchFormDataConsumerHandle::create(context, formData.release());
89 } else if (V8PasswordCredential::hasInstance(v8Body, isolate)) { 89 } else if (V8PasswordCredential::hasInstance(v8Body, isolate)) {
90 // See https://w3c.github.io/webappsec-credential-management/#monkey-pat ching-fetch-4 90 // See https://w3c.github.io/webappsec-credential-management/#monkey-pat ching-fetch-4
91 // and https://w3c.github.io/webappsec-credential-management/#monkey-pat ching-fetch-3 91 // and https://w3c.github.io/webappsec-credential-management/#monkey-pat ching-fetch-3
92 isCredentialRequest = true; 92 isCredentialRequest = true;
93 PasswordCredential* credential = V8PasswordCredential::toImpl(v8::Local< v8::Object>::Cast(v8Body)); 93 PasswordCredential* credential = V8PasswordCredential::toImpl(v8::Local< v8::Object>::Cast(v8Body));
94 94
95 RefPtr<EncodedFormData> encodedData = credential->encodeFormData(); 95 RefPtr<EncodedFormData> encodedData = credential->encodeFormData(content Type);
96 if (encodedData->boundary().isEmpty())
97 contentType = AtomicString("application/x-www-form-urlencoded;charse t=UTF-8", AtomicString::ConstructFromLiteral);
98 else
99 contentType = AtomicString("multipart/form-data; boundary=", AtomicS tring::ConstructFromLiteral) + encodedData->boundary().data();
100 body = FetchFormDataConsumerHandle::create(context, encodedData.release( )); 96 body = FetchFormDataConsumerHandle::create(context, encodedData.release( ));
101 } else if (v8Body->IsString()) { 97 } else if (v8Body->IsString()) {
102 contentType = "text/plain;charset=UTF-8"; 98 contentType = "text/plain;charset=UTF-8";
103 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState)); 99 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState));
104 } 100 }
105 } 101 }
106 102
107 } 103 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698