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

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: 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/fetch/Request.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 AtomicString referrerString; 47 AtomicString referrerString;
48 bool isReferrerStringSet = DictionaryHelper::get(options, "referrer", referr erString); 48 bool isReferrerStringSet = DictionaryHelper::get(options, "referrer", referr erString);
49 areAnyMembersSet |= isReferrerStringSet; 49 areAnyMembersSet |= isReferrerStringSet;
50 areAnyMembersSet |= DictionaryHelper::get(options, "integrity", integrity); 50 areAnyMembersSet |= DictionaryHelper::get(options, "integrity", integrity);
51 51
52 v8::Local<v8::Value> v8Body; 52 v8::Local<v8::Value> v8Body;
53 bool isBodySet = DictionaryHelper::get(options, "body", v8Body); 53 bool isBodySet = DictionaryHelper::get(options, "body", v8Body);
54 areAnyMembersSet |= isBodySet; 54 areAnyMembersSet |= isBodySet;
55 55
56 if (areAnyMembersSet) { 56 if (areAnyMembersSet) {
57 // If any of init's members are present, unset request's 57 // A part of the Request constructor algorithm is performed here. See
58 // omit-Origin-header flag, set request's referrer to "client", 58 // the comments in the Request constructor code for the detail.
59 // and request's referrer policy to the empty string. 59
60 //
61 // We need to use "about:client" instead of |clientReferrerString|, 60 // We need to use "about:client" instead of |clientReferrerString|,
62 // because "about:client" => |clientReferrerString| conversion is done 61 // because "about:client" => |clientReferrerString| conversion is done
63 // in Request::createRequestWithRequestOrString. 62 // in Request::createRequestWithRequestOrString.
64 referrer = Referrer("about:client", ReferrerPolicyDefault); 63 referrer = Referrer("about:client", ReferrerPolicyDefault);
65 if (isReferrerStringSet) 64 if (isReferrerStringSet)
66 referrer.referrer = referrerString; 65 referrer.referrer = referrerString;
67 } 66 }
68 67
69 if (!isBodySet || v8Body->IsUndefined() || v8Body->IsNull()) 68 if (!isBodySet || v8Body->IsUndefined() || v8Body->IsNull())
70 return; 69 return;
(...skipping 28 matching lines...) Expand all
99 else 98 else
100 contentType = AtomicString("multipart/form-data; boundary=", AtomicS tring::ConstructFromLiteral) + encodedData->boundary().data(); 99 contentType = AtomicString("multipart/form-data; boundary=", AtomicS tring::ConstructFromLiteral) + encodedData->boundary().data();
101 body = FetchFormDataConsumerHandle::create(context, encodedData.release( )); 100 body = FetchFormDataConsumerHandle::create(context, encodedData.release( ));
102 } else if (v8Body->IsString()) { 101 } else if (v8Body->IsString()) {
103 contentType = "text/plain;charset=UTF-8"; 102 contentType = "text/plain;charset=UTF-8";
104 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState)); 103 body = FetchFormDataConsumerHandle::create(toUSVString(isolate, v8Body, exceptionState));
105 } 104 }
106 } 105 }
107 106
108 } 107 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Request.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698