| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |