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

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

Issue 1451333002: Update comments in Request constructor to explain referrer handling more clearly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 "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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 AtomicString referrerString; 42 AtomicString referrerString;
43 bool isReferrerStringSet = DictionaryHelper::get(options, "referrer", referr erString); 43 bool isReferrerStringSet = DictionaryHelper::get(options, "referrer", referr erString);
44 areAnyMembersSet = areAnyMembersSet || isReferrerStringSet; 44 areAnyMembersSet = areAnyMembersSet || isReferrerStringSet;
45 areAnyMembersSet = DictionaryHelper::get(options, "integrity", integrity) || areAnyMembersSet; 45 areAnyMembersSet = DictionaryHelper::get(options, "integrity", integrity) || areAnyMembersSet;
46 46
47 v8::Local<v8::Value> v8Body; 47 v8::Local<v8::Value> v8Body;
48 bool isBodySet = DictionaryHelper::get(options, "body", v8Body); 48 bool isBodySet = DictionaryHelper::get(options, "body", v8Body);
49 areAnyMembersSet = areAnyMembersSet || isBodySet; 49 areAnyMembersSet = areAnyMembersSet || isBodySet;
50 50
51 if (areAnyMembersSet) { 51 if (areAnyMembersSet) {
52 // If any of init's members are present, unset request's 52 // A part of the Request constructor algorithm is performed here. See th e
yhirano 2015/11/17 09:31:55 Please wrap comments in 80 columns.
tyoshino (SeeGerritForStatus) 2015/11/18 13:42:51 Done.
53 // omit-Origin-header flag, set request's referrer to "client", 53 // comments in the Request constructor code for the detail.
54 // and request's referrer policy to the empty string. 54
55 //
56 // We need to use "about:client" instead of |clientReferrerString|, 55 // We need to use "about:client" instead of |clientReferrerString|,
57 // because "about:client" => |clientReferrerString| conversion is done 56 // because "about:client" => |clientReferrerString| conversion is done
58 // in Request::createRequestWithRequestOrString. 57 // in Request::createRequestWithRequestOrString.
59 referrer = Referrer("about:client", ReferrerPolicyDefault); 58 referrer = Referrer("about:client", ReferrerPolicyDefault);
60 if (isReferrerStringSet) 59 if (isReferrerStringSet)
61 referrer.referrer = referrerString; 60 referrer.referrer = referrerString;
62 } 61 }
63 62
64 if (!isBodySet || v8Body->IsUndefined() || v8Body->IsNull()) 63 if (!isBodySet || v8Body->IsUndefined() || v8Body->IsNull())
65 return; 64 return;
(...skipping 12 matching lines...) Expand all
78 // FormDataEncoder::generateUniqueBoundaryString. 77 // FormDataEncoder::generateUniqueBoundaryString.
79 contentType = AtomicString("multipart/form-data; boundary=", AtomicStrin g::ConstructFromLiteral) + formData->boundary().data(); 78 contentType = AtomicString("multipart/form-data; boundary=", AtomicStrin g::ConstructFromLiteral) + formData->boundary().data();
80 body = FetchFormDataConsumerHandle::create(context, formData.release()); 79 body = FetchFormDataConsumerHandle::create(context, formData.release());
81 } else if (v8Body->IsString()) { 80 } else if (v8Body->IsString()) {
82 contentType = "text/plain;charset=UTF-8"; 81 contentType = "text/plain;charset=UTF-8";
83 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState)); 82 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState));
84 } 83 }
85 } 84 }
86 85
87 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698