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 "modules/fetch/Request.h" | 5 #include "modules/fetch/Request.h" |
6 | 6 |
7 #include "bindings/core/v8/Dictionary.h" | 7 #include "bindings/core/v8/Dictionary.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "core/fetch/FetchUtils.h" | 10 #include "core/fetch/FetchUtils.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // header list, unsafe-request flag is set, client is entry settings object, | 90 // header list, unsafe-request flag is set, client is entry settings object, |
91 // window is |window|, origin is "client", omit-Origin-header flag is | 91 // window is |window|, origin is "client", omit-Origin-header flag is |
92 // |request|'s omit-Origin-header flag, same-origin data-URL flag is set, | 92 // |request|'s omit-Origin-header flag, same-origin data-URL flag is set, |
93 // referrer is |request|'s referrer, referrer policy is |request|'s | 93 // referrer is |request|'s referrer, referrer policy is |request|'s |
94 // referrer policy, destination is the empty string, mode is |request|'s | 94 // referrer policy, destination is the empty string, mode is |request|'s |
95 // mode, credentials mode is |request|'s credentials mode, cache mode is | 95 // mode, credentials mode is |request|'s credentials mode, cache mode is |
96 // |request|'s cache mode, redirect mode is |request|'s redirect mode, and | 96 // |request|'s cache mode, redirect mode is |request|'s redirect mode, and |
97 // integrity metadata is |request|'s integrity metadata." | 97 // integrity metadata is |request|'s integrity metadata." |
98 FetchRequestData* request = createCopyOfFetchRequestDataForFetch( | 98 FetchRequestData* request = createCopyOfFetchRequestDataForFetch( |
99 scriptState, | 99 scriptState, |
100 inputRequest ? inputRequest->request() : FetchRequestData::create()); | 100 inputRequest ? inputRequest->getRequest() : FetchRequestData::create()); |
101 | 101 |
102 // We don't use fallback values. We set these flags directly in below. | 102 // We don't use fallback values. We set these flags directly in below. |
103 // - "Let |fallbackMode| be null." | 103 // - "Let |fallbackMode| be null." |
104 // - "Let |fallbackCredentials| be null." | 104 // - "Let |fallbackCredentials| be null." |
105 // - "Let |baseURL| be entry settings object's API base URL." | 105 // - "Let |baseURL| be entry settings object's API base URL." |
106 | 106 |
107 // "If |input| is a string, run these substeps:" | 107 // "If |input| is a string, run these substeps:" |
108 if (!inputRequest) { | 108 if (!inputRequest) { |
109 // "Let |parsedURL| be the result of parsing |input| with |baseURL|." | 109 // "Let |parsedURL| be the result of parsing |input| with |baseURL|." |
110 KURL parsedURL = | 110 KURL parsedURL = |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // | 304 // |
305 // We don't create a copy of r's Headers object when init's headers member | 305 // We don't create a copy of r's Headers object when init's headers member |
306 // is present. | 306 // is present. |
307 Headers* headers = nullptr; | 307 Headers* headers = nullptr; |
308 if (!init.headers && init.headersDictionary.isUndefinedOrNull()) { | 308 if (!init.headers && init.headersDictionary.isUndefinedOrNull()) { |
309 headers = r->getHeaders()->clone(); | 309 headers = r->getHeaders()->clone(); |
310 } | 310 } |
311 // "Empty |r|'s request's header list." | 311 // "Empty |r|'s request's header list." |
312 r->m_request->headerList()->clearList(); | 312 r->m_request->headerList()->clearList(); |
313 // "If |r|'s request's mode is "no-cors", run these substeps: | 313 // "If |r|'s request's mode is "no-cors", run these substeps: |
314 if (r->request()->mode() == WebURLRequest::FetchRequestModeNoCORS) { | 314 if (r->getRequest()->mode() == WebURLRequest::FetchRequestModeNoCORS) { |
315 // "If |r|'s request's method is not a simple method, throw a | 315 // "If |r|'s request's method is not a simple method, throw a |
316 // TypeError." | 316 // TypeError." |
317 if (!FetchUtils::isSimpleMethod(r->request()->method())) { | 317 if (!FetchUtils::isSimpleMethod(r->getRequest()->method())) { |
318 exceptionState.throwTypeError("'" + r->request()->method() + | 318 exceptionState.throwTypeError("'" + r->getRequest()->method() + |
319 "' is unsupported in no-cors mode."); | 319 "' is unsupported in no-cors mode."); |
320 return nullptr; | 320 return nullptr; |
321 } | 321 } |
322 // "If |request|'s integrity metadata is not the empty string, throw a | 322 // "If |request|'s integrity metadata is not the empty string, throw a |
323 // TypeError." | 323 // TypeError." |
324 if (!request->integrity().isEmpty()) { | 324 if (!request->integrity().isEmpty()) { |
325 exceptionState.throwTypeError( | 325 exceptionState.throwTypeError( |
326 "The integrity attribute is unsupported in no-cors mode."); | 326 "The integrity attribute is unsupported in no-cors mode."); |
327 return nullptr; | 327 return nullptr; |
328 } | 328 } |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); | 733 V8HiddenValue::internalBodyBuffer(scriptState->isolate()), bodyBuffer); |
734 } | 734 } |
735 | 735 |
736 DEFINE_TRACE(Request) { | 736 DEFINE_TRACE(Request) { |
737 Body::trace(visitor); | 737 Body::trace(visitor); |
738 visitor->trace(m_request); | 738 visitor->trace(m_request); |
739 visitor->trace(m_headers); | 739 visitor->trace(m_headers); |
740 } | 740 } |
741 | 741 |
742 } // namespace blink | 742 } // namespace blink |
OLD | NEW |