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

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

Issue 2852423002: Expose passwords to JavaScript in Credential Manager API (Closed)
Patch Set: Console Message Created 3 years, 7 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/V8BindingForCore.h" 10 #include "bindings/core/v8/V8BindingForCore.h"
11 #include "bindings/core/v8/V8Blob.h" 11 #include "bindings/core/v8/V8Blob.h"
12 #include "bindings/core/v8/V8FormData.h" 12 #include "bindings/core/v8/V8FormData.h"
13 #include "bindings/core/v8/V8URLSearchParams.h" 13 #include "bindings/core/v8/V8URLSearchParams.h"
14 #include "bindings/modules/v8/V8PasswordCredential.h" 14 #include "bindings/modules/v8/V8PasswordCredential.h"
15 #include "core/dom/URLSearchParams.h" 15 #include "core/dom/URLSearchParams.h"
16 #include "core/fileapi/Blob.h" 16 #include "core/fileapi/Blob.h"
17 #include "core/frame/Deprecation.h"
18 #include "core/frame/UseCounter.h"
17 #include "core/html/FormData.h" 19 #include "core/html/FormData.h"
18 #include "modules/fetch/BlobBytesConsumer.h" 20 #include "modules/fetch/BlobBytesConsumer.h"
19 #include "modules/fetch/FormDataBytesConsumer.h" 21 #include "modules/fetch/FormDataBytesConsumer.h"
20 #include "modules/fetch/Headers.h" 22 #include "modules/fetch/Headers.h"
21 #include "platform/RuntimeEnabledFeatures.h" 23 #include "platform/RuntimeEnabledFeatures.h"
22 #include "platform/blob/BlobData.h" 24 #include "platform/blob/BlobData.h"
23 #include "platform/network/EncodedFormData.h" 25 #include "platform/network/EncodedFormData.h"
24 #include "platform/weborigin/ReferrerPolicy.h" 26 #include "platform/weborigin/ReferrerPolicy.h"
25 27
26 namespace blink { 28 namespace blink {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (is_header_set) { 110 if (is_header_set) {
109 V8ByteStringSequenceSequenceOrByteStringByteStringRecord::toImpl( 111 V8ByteStringSequenceSequenceOrByteStringByteStringRecord::toImpl(
110 isolate, v8_headers, headers, UnionTypeConversionMode::kNotNullable, 112 isolate, v8_headers, headers, UnionTypeConversionMode::kNotNullable,
111 exception_state); 113 exception_state);
112 if (exception_state.HadException()) 114 if (exception_state.HadException())
113 return; 115 return;
114 } 116 }
115 117
116 if (is_credential_set) { 118 if (is_credential_set) {
117 if (V8PasswordCredential::hasInstance(v8_credential, isolate)) { 119 if (V8PasswordCredential::hasInstance(v8_credential, isolate)) {
120 Deprecation::CountDeprecation(context,
121 UseCounter::kCredentialManagerCustomFetch);
118 // TODO(mkwst): According to the spec, we'd serialize this once we touch 122 // TODO(mkwst): According to the spec, we'd serialize this once we touch
119 // the network. We're serializing it here, ahead of time, because lifetime 123 // the network. We're serializing it here, ahead of time, because lifetime
120 // issues around ResourceRequest make it pretty difficult to pass a 124 // issues around ResourceRequest make it pretty difficult to pass a
121 // PasswordCredential around at the platform level, and the hop between 125 // PasswordCredential around at the platform level, and the hop between
122 // the browser and renderer processes to deal with service workers is 126 // the browser and renderer processes to deal with service workers is
123 // equally painful. There should be no developer-visible difference in 127 // equally painful. There should be no developer-visible difference in
124 // behavior with this option, except that the `Content-Type` header will 128 // behavior with this option, except that the `Content-Type` header will
125 // be set early. That seems reasonable. 129 // be set early. That seems reasonable.
126 PasswordCredential* credential = 130 PasswordCredential* credential =
127 V8PasswordCredential::toImpl(v8_credential.As<v8::Object>()); 131 V8PasswordCredential::toImpl(v8_credential.As<v8::Object>());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 AtomicString("application/x-www-form-urlencoded;charset=UTF-8"); 167 AtomicString("application/x-www-form-urlencoded;charset=UTF-8");
164 body = new FormDataBytesConsumer(context, form_data.Release()); 168 body = new FormDataBytesConsumer(context, form_data.Release());
165 } else if (v8_body->IsString()) { 169 } else if (v8_body->IsString()) {
166 content_type = "text/plain;charset=UTF-8"; 170 content_type = "text/plain;charset=UTF-8";
167 body = new FormDataBytesConsumer( 171 body = new FormDataBytesConsumer(
168 ToUSVString(isolate, v8_body, exception_state)); 172 ToUSVString(isolate, v8_body, exception_state));
169 } 173 }
170 } 174 }
171 175
172 } // namespace blink 176 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698