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/Request.h" | 6 #include "modules/fetch/Request.h" |
7 | 7 |
8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 DOMWrapperWorld& world = scriptState->world(); | 34 DOMWrapperWorld& world = scriptState->world(); |
35 if (world.isIsolatedWorld()) | 35 if (world.isIsolatedWorld()) |
36 request->setOrigin(world.isolatedWorldSecurityOrigin()); | 36 request->setOrigin(world.isolatedWorldSecurityOrigin()); |
37 else | 37 else |
38 request->setOrigin(scriptState->executionContext()->securityOrigin()); | 38 request->setOrigin(scriptState->executionContext()->securityOrigin()); |
39 // FIXME: Set ForceOriginHeaderFlag. | 39 // FIXME: Set ForceOriginHeaderFlag. |
40 request->setSameOriginDataURLFlag(true); | 40 request->setSameOriginDataURLFlag(true); |
41 request->mutableReferrer()->setClient(); | 41 request->mutableReferrer()->setClient(); |
42 request->setMode(original->mode()); | 42 request->setMode(original->mode()); |
43 request->setCredentials(original->credentials()); | 43 request->setCredentials(original->credentials()); |
| 44 request->setRedirect(original->redirect()); |
44 // FIXME: Set cache mode. | 45 // FIXME: Set cache mode. |
45 // TODO(yhirano): Set redirect mode. | 46 // TODO(yhirano): Set redirect mode. |
46 return request; | 47 return request; |
47 } | 48 } |
48 | 49 |
49 Request* Request::createRequestWithRequestOrString(ScriptState* scriptState, Req
uest* inputRequest, const String& inputString, const RequestInit& init, Exceptio
nState& exceptionState) | 50 Request* Request::createRequestWithRequestOrString(ScriptState* scriptState, Req
uest* inputRequest, const String& inputString, const RequestInit& init, Exceptio
nState& exceptionState) |
50 { | 51 { |
51 // "1. Let |temporaryBody| be null." | 52 // "1. Let |temporaryBody| be null." |
52 BodyStreamBuffer* temporaryBody = nullptr; | 53 BodyStreamBuffer* temporaryBody = nullptr; |
53 | 54 |
(...skipping 13 matching lines...) Expand all Loading... |
67 // "2. Set |temporaryBody| to |input|'s body." | 68 // "2. Set |temporaryBody| to |input|'s body." |
68 if (inputRequest->bodyUsed()) { | 69 if (inputRequest->bodyUsed()) { |
69 exceptionState.throwTypeError("Cannot construct a Request with a Req
uest object that has already been used."); | 70 exceptionState.throwTypeError("Cannot construct a Request with a Req
uest object that has already been used."); |
70 return nullptr; | 71 return nullptr; |
71 } | 72 } |
72 temporaryBody = inputRequest->bodyBuffer(); | 73 temporaryBody = inputRequest->bodyBuffer(); |
73 } | 74 } |
74 | 75 |
75 // "3. Let |request| be |input|'s request, if |input| is a Request object, | 76 // "3. Let |request| be |input|'s request, if |input| is a Request object, |
76 // and a new request otherwise." | 77 // and a new request otherwise." |
77 // "4. Set |request| to a new request whose url is |request|'s url, method | 78 // TODO(yhirano): |
78 // is |request|'s method, header list is a copy of |request|'s header list, | 79 // "4. Let origin be entry settings object's origin." |
79 // unsafe request flag is set, client is entry settings object, origin is | 80 // "5. Let window be client." |
80 // entry settings object's origin, force Origin header flag is set, | 81 // "6. If request's window is an environment settings object and its |
81 // same-origin data URL flag is set, context is the empty string, mode is | 82 // origin is same origin with origin, set window to request's window." |
82 // |request|'s mode, credentials mode is |request|'s credentials mode, | 83 // "7. If init's window member is present and it is not null, throw a |
83 // cache mode is |request|'s cache mode, and redirect mode is request's | 84 // TypeError." |
84 // redirect mode." | 85 // "8. If init's window member is present, set window to no-window." |
| 86 // "9. Set |request| to a new request whose url is |request|'s current url, |
| 87 // method is |request|'s method, header list is a copy of |request|'s header |
| 88 // list, unsafe-request flag is set, client is entry settings object, window |
| 89 // is window, origin is origin, force-Origin-header flag is set, same-origin |
| 90 // data-URL flag is set, referrer is request's referrer, referrer policy is |
| 91 // |request|'s referrer policy, context is the empty string, mode is |
| 92 // |request|'s mode, credentials mode is |request|'s credentials mode, cache |
| 93 // mode is |request|'s cache mode, redirect mode is |request|'s redirect |
| 94 // mode, and integrity metadata is |request|'s integrity metadata." |
85 FetchRequestData* request = createCopyOfFetchRequestDataForFetch(scriptState
, inputRequest ? inputRequest->request() : FetchRequestData::create()); | 95 FetchRequestData* request = createCopyOfFetchRequestDataForFetch(scriptState
, inputRequest ? inputRequest->request() : FetchRequestData::create()); |
86 | 96 |
87 // "5. Let |fallbackMode| be null." | 97 // "10. Let |fallbackMode| be null." |
88 // "6. Let |fallbackCredentials| be null." | 98 // "11. Let |fallbackCredentials| be null." |
89 // "7. Let |fallbackCache| be null." | 99 // "12. Let |baseURL| be entry settings object's API base URL." |
90 // "8. Let |fallbackRedirect| be null." | |
91 // We don't use fallback values. We set these flags directly in below. | 100 // We don't use fallback values. We set these flags directly in below. |
92 | 101 |
93 // "9. If |input| is a string, run these substeps:" | 102 // "13. If |input| is a string, run these substeps:" |
94 if (!inputRequest) { | 103 if (!inputRequest) { |
95 // "1. Let |parsedURL| be the result of parsing |input| with entry | 104 // "1. Let |parsedURL| be the result of parsing |input| with |baseURL|." |
96 // settings object's API base URL." | |
97 KURL parsedURL = scriptState->executionContext()->completeURL(inputStrin
g); | 105 KURL parsedURL = scriptState->executionContext()->completeURL(inputStrin
g); |
98 // "2. If |parsedURL| is failure, throw a TypeError." | 106 // "2. If |parsedURL| is failure, throw a TypeError." |
99 if (!parsedURL.isValid()) { | 107 if (!parsedURL.isValid()) { |
100 exceptionState.throwTypeError("Failed to parse URL from " + inputStr
ing); | 108 exceptionState.throwTypeError("Failed to parse URL from " + inputStr
ing); |
101 return nullptr; | 109 return nullptr; |
102 } | 110 } |
103 // TODO(yhirano): "3. If |parsedURL| includes credentials, throw a | 111 // TODO(yhirano): "3. If |parsedURL| includes credentials, throw a |
104 // TypeError." | 112 // TypeError." |
105 // "4. Set |request|'s url to |parsedURL|." | 113 // "4. Set |request|'s url to |parsedURL|." |
106 request->setURL(parsedURL); | 114 request->setURL(parsedURL); |
107 // "5. Set |fallbackMode| to CORS." | 115 // "5. Set |fallbackMode| to CORS." |
108 // "6. Set |fallbackCredentials| to omit." | 116 // "6. Set |fallbackCredentials| to omit." |
109 // "7. Set |fallbackCache| to default." | |
110 // "8. Set |fallbackRedirect| to follow." | |
111 // We don't use fallback values. We set these flags directly in below. | 117 // We don't use fallback values. We set these flags directly in below. |
112 } | 118 } |
113 | 119 |
114 // "10. Let |mode| be |init|'s mode member if it is present, and | 120 // TODO(yhirano): |
| 121 // "14. If any of |init|'s members are present, set |request|'s referrer |
| 122 // to client, and |request|'s referrer policy to the empty string. |
| 123 // 15. If |init|'s referrer member is present, run these substeps:... |
| 124 // 16. If |init|'s referrerPolicy member is present, set |request|'s |
| 125 // referrer policy to it." |
| 126 |
| 127 // "17. Let |mode| be |init|'s mode member if it is present, and |
115 // |fallbackMode| otherwise." | 128 // |fallbackMode| otherwise." |
116 // "11. If |mode| is non-null, set |request|'s mode to |mode|." | 129 // "18. If |mode| is non-null, set |request|'s mode to |mode|." |
117 if (init.mode == "same-origin") { | 130 if (init.mode == "same-origin") { |
118 request->setMode(WebURLRequest::FetchRequestModeSameOrigin); | 131 request->setMode(WebURLRequest::FetchRequestModeSameOrigin); |
119 } else if (init.mode == "no-cors") { | 132 } else if (init.mode == "no-cors") { |
120 request->setMode(WebURLRequest::FetchRequestModeNoCORS); | 133 request->setMode(WebURLRequest::FetchRequestModeNoCORS); |
121 } else if (init.mode == "cors") { | 134 } else if (init.mode == "cors") { |
122 request->setMode(WebURLRequest::FetchRequestModeCORS); | 135 request->setMode(WebURLRequest::FetchRequestModeCORS); |
123 } else { | 136 } else { |
124 if (!inputRequest) | 137 if (!inputRequest) |
125 request->setMode(WebURLRequest::FetchRequestModeCORS); | 138 request->setMode(WebURLRequest::FetchRequestModeCORS); |
126 } | 139 } |
127 | 140 |
128 // "12. Let |credentials| be |init|'s credentials member if it is present, | 141 // "19. Let |credentials| be |init|'s credentials member if it is present, |
129 // and |fallbackCredentials| otherwise." | 142 // and |fallbackCredentials| otherwise." |
130 // "13. If |credentials| is non-null, set |request|'s credentials mode to | 143 // "20. If |credentials| is non-null, set |request|'s credentials mode to |
131 // |credentials|. | 144 // |credentials|. |
132 if (init.credentials == "omit") { | 145 if (init.credentials == "omit") { |
133 request->setCredentials(WebURLRequest::FetchCredentialsModeOmit); | 146 request->setCredentials(WebURLRequest::FetchCredentialsModeOmit); |
134 } else if (init.credentials == "same-origin") { | 147 } else if (init.credentials == "same-origin") { |
135 request->setCredentials(WebURLRequest::FetchCredentialsModeSameOrigin); | 148 request->setCredentials(WebURLRequest::FetchCredentialsModeSameOrigin); |
136 } else if (init.credentials == "include") { | 149 } else if (init.credentials == "include") { |
137 request->setCredentials(WebURLRequest::FetchCredentialsModeInclude); | 150 request->setCredentials(WebURLRequest::FetchCredentialsModeInclude); |
138 } else { | 151 } else { |
139 if (!inputRequest) | 152 if (!inputRequest) |
140 request->setCredentials(WebURLRequest::FetchCredentialsModeOmit); | 153 request->setCredentials(WebURLRequest::FetchCredentialsModeOmit); |
141 } | 154 } |
142 | 155 |
143 // FIXME: "14. Let |cache| be |init|'s cache member if it is present, and | 156 // TODO(yhirano): "21. If |init|'s cache member is present, set |request|'s |
144 // |fallbackCache| otherwise." | 157 // cache mode to it." |
145 // FIXME: "15. If |cache| is non-null, set |request|'s cache mode to | |
146 // |cache|." | |
147 // TODO(yhirano): "16. If |init|'s redirect member is present and its is | |
148 // manual, throw a TypeError." | |
149 // TODO(yhirano): "17. Let |redirect| be |init|'s redirect member if it is | |
150 // present, and |fallbackRedirect| otherwise." | |
151 // TODO(yhirano): "18 If |redirect| is non-null, set |request|'s redirect | |
152 // mode to |redirect|." | |
153 // TODO(yhirano): "19 If |request|'s redirect mode is manual, set it to | |
154 // follow." | |
155 | 158 |
156 // "20. If |init|'s method member is present, let |method| be it and run | 159 // TODO(horo): "22. If |init|'s redirect member is present, set |request|'s |
| 160 // redirect mode to it." |
| 161 |
| 162 // TODO(jww): "23. If |init|'s integrity member is present, set |request|'s |
| 163 // integrity metadata to it." |
| 164 |
| 165 // "24. If |init|'s method member is present, let |method| be it and run |
157 // these substeps:" | 166 // these substeps:" |
158 if (!init.method.isNull()) { | 167 if (!init.method.isNull()) { |
159 // "1. If |method| is not a method or method is a forbidden method, | 168 // "1. If |method| is not a method or method is a forbidden method, |
160 // throw a TypeError." | 169 // throw a TypeError." |
161 if (!isValidHTTPToken(init.method)) { | 170 if (!isValidHTTPToken(init.method)) { |
162 exceptionState.throwTypeError("'" + init.method + "' is not a valid
HTTP method."); | 171 exceptionState.throwTypeError("'" + init.method + "' is not a valid
HTTP method."); |
163 return nullptr; | 172 return nullptr; |
164 } | 173 } |
165 if (FetchUtils::isForbiddenMethod(init.method)) { | 174 if (FetchUtils::isForbiddenMethod(init.method)) { |
166 exceptionState.throwTypeError("'" + init.method + "' HTTP method is
unsupported."); | 175 exceptionState.throwTypeError("'" + init.method + "' HTTP method is
unsupported."); |
167 return nullptr; | 176 return nullptr; |
168 } | 177 } |
169 // "2. Normalize |method|." | 178 // "2. Normalize |method|." |
170 // "3. Set |request|'s method to |method|." | 179 // "3. Set |request|'s method to |method|." |
171 request->setMethod(FetchUtils::normalizeMethod(AtomicString(init.method)
)); | 180 request->setMethod(FetchUtils::normalizeMethod(AtomicString(init.method)
)); |
172 } | 181 } |
173 // "21. Let |r| be a new Request object associated with |request| and a new | 182 // "25. Let |r| be a new Request object associated with |request| and a new |
174 // Headers object whose guard is request." | 183 // Headers object whose guard is request." |
175 Request* r = Request::create(scriptState->executionContext(), request); | 184 Request* r = Request::create(scriptState->executionContext(), request); |
176 // "22. Let |headers| be a copy of |r|'s Headers object." | 185 // "26. Let |headers| be a copy of |r|'s Headers object." |
177 // "23. If |init|'s headers member is present, set |headers| to |init|'s | 186 // "27. If |init|'s headers member is present, set |headers| to |init|'s |
178 // headers member." | 187 // headers member." |
179 // We don't create a copy of r's Headers object when init's headers member | 188 // We don't create a copy of r's Headers object when init's headers member |
180 // is present. | 189 // is present. |
181 Headers* headers = nullptr; | 190 Headers* headers = nullptr; |
182 if (!init.headers && init.headersDictionary.isUndefinedOrNull()) { | 191 if (!init.headers && init.headersDictionary.isUndefinedOrNull()) { |
183 headers = r->headers()->clone(); | 192 headers = r->headers()->clone(); |
184 } | 193 } |
185 // "24. Empty |r|'s request's header list." | 194 // "28. Empty |r|'s request's header list." |
186 r->m_request->headerList()->clearList(); | 195 r->m_request->headerList()->clearList(); |
187 // "25. If |r|'s request's mode is no CORS, run these substeps: | 196 // "29. If |r|'s request's mode is no CORS, run these substeps: |
188 if (r->request()->mode() == WebURLRequest::FetchRequestModeNoCORS) { | 197 if (r->request()->mode() == WebURLRequest::FetchRequestModeNoCORS) { |
189 // "1. If |r|'s request's method is not a simple method, throw a | 198 // "1. If |r|'s request's method is not a simple method, throw a |
190 // TypeError." | 199 // TypeError." |
191 if (!FetchUtils::isSimpleMethod(r->request()->method())) { | 200 if (!FetchUtils::isSimpleMethod(r->request()->method())) { |
192 exceptionState.throwTypeError("'" + r->request()->method() + "' is u
nsupported in no-cors mode."); | 201 exceptionState.throwTypeError("'" + r->request()->method() + "' is u
nsupported in no-cors mode."); |
193 return nullptr; | 202 return nullptr; |
194 } | 203 } |
195 // "Set |r|'s Headers object's guard to |request-no-CORS|. | 204 // "Set |r|'s Headers object's guard to |request-no-CORS|. |
196 r->headers()->setGuard(Headers::RequestNoCORSGuard); | 205 r->headers()->setGuard(Headers::RequestNoCORSGuard); |
197 } | 206 } |
198 // "26. Fill |r|'s Headers object with |headers|. Rethrow any exceptions." | 207 // "30. Fill |r|'s Headers object with |headers|. Rethrow any exceptions." |
199 if (init.headers) { | 208 if (init.headers) { |
200 ASSERT(init.headersDictionary.isUndefinedOrNull()); | 209 ASSERT(init.headersDictionary.isUndefinedOrNull()); |
201 r->headers()->fillWith(init.headers.get(), exceptionState); | 210 r->headers()->fillWith(init.headers.get(), exceptionState); |
202 } else if (!init.headersDictionary.isUndefinedOrNull()) { | 211 } else if (!init.headersDictionary.isUndefinedOrNull()) { |
203 r->headers()->fillWith(init.headersDictionary, exceptionState); | 212 r->headers()->fillWith(init.headersDictionary, exceptionState); |
204 } else { | 213 } else { |
205 ASSERT(headers); | 214 ASSERT(headers); |
206 r->headers()->fillWith(headers, exceptionState); | 215 r->headers()->fillWith(headers, exceptionState); |
207 } | 216 } |
208 if (exceptionState.hadException()) | 217 if (exceptionState.hadException()) |
209 return nullptr; | 218 return nullptr; |
210 | 219 |
211 // "27. If either |init|'s body member is present or |temporaryBody| is | 220 // "31. If either |init|'s body member is present or |temporaryBody| is |
212 // non-null, and |request|'s method is `GET` or `HEAD`, throw a TypeError. | 221 // non-null, and |request|'s method is `GET` or `HEAD`, throw a TypeError. |
213 if (init.bodyBlobHandle || temporaryBody) { | 222 if (init.bodyBlobHandle || temporaryBody) { |
214 if (request->method() == "GET" || request->method() == "HEAD") { | 223 if (request->method() == "GET" || request->method() == "HEAD") { |
215 exceptionState.throwTypeError("Request with GET/HEAD method cannot h
ave body."); | 224 exceptionState.throwTypeError("Request with GET/HEAD method cannot h
ave body."); |
216 return nullptr; | 225 return nullptr; |
217 } | 226 } |
218 } | 227 } |
219 | 228 |
220 // "28. If |init|'s body member is present, run these substeps:" | 229 // "32. If |init|'s body member is present, run these substeps:" |
221 if (init.bodyBlobHandle) { | 230 if (init.bodyBlobHandle) { |
222 // "1. Let |stream| and |Content-Type| be the result of extracting | 231 // "1. Let |stream| and |Content-Type| be the result of extracting |
223 // |init|'s body member." | 232 // |init|'s body member." |
224 // "2. Set |temporaryBody| to |stream|. | 233 // "2. Set |temporaryBody| to |stream|. |
225 // "3. If |Content-Type| is non-null and |r|'s request's header list | 234 // "3. If |Content-Type| is non-null and |r|'s request's header list |
226 // contains no header named `Content-Type`, append | 235 // contains no header named `Content-Type`, append |
227 // `Content-Type`/|Content-Type| to |r|'s Headers object. Rethrow any | 236 // `Content-Type`/|Content-Type| to |r|'s Headers object. Rethrow any |
228 // exception." | 237 // exception." |
229 temporaryBody = new BodyStreamBuffer(FetchBlobDataConsumerHandle::create
(scriptState->executionContext(), init.bodyBlobHandle)); | 238 temporaryBody = new BodyStreamBuffer(FetchBlobDataConsumerHandle::create
(scriptState->executionContext(), init.bodyBlobHandle)); |
230 if (!init.bodyBlobHandle->type().isEmpty() && !r->headers()->has("Conten
t-Type", exceptionState)) { | 239 if (!init.bodyBlobHandle->type().isEmpty() && !r->headers()->has("Conten
t-Type", exceptionState)) { |
231 r->headers()->append("Content-Type", init.bodyBlobHandle->type(), ex
ceptionState); | 240 r->headers()->append("Content-Type", init.bodyBlobHandle->type(), ex
ceptionState); |
232 } | 241 } |
233 if (exceptionState.hadException()) | 242 if (exceptionState.hadException()) |
234 return nullptr; | 243 return nullptr; |
235 } | 244 } |
236 | 245 |
237 // "29. Set |r|'s body to |temporaryBody|. | 246 // "33. Set |r|'s body to |temporaryBody|. |
238 if (temporaryBody) | 247 if (temporaryBody) |
239 r->m_request->setBuffer(temporaryBody); | 248 r->m_request->setBuffer(temporaryBody); |
240 | 249 |
241 // "30. Set |r|'s MIME type to the result of extracting a MIME type from | 250 // "34. Set |r|'s MIME type to the result of extracting a MIME type from |
242 // |r|'s request's header list." | 251 // |r|'s request's header list." |
243 r->m_request->setMIMEType(r->m_request->headerList()->extractMIMEType()); | 252 r->m_request->setMIMEType(r->m_request->headerList()->extractMIMEType()); |
244 | 253 |
245 // "31. If |input| is a Request object and |input|'s body is non-null, run | 254 // "35. If |input| is a Request object and |input|'s body is non-null, run |
246 // these substeps:" | 255 // these substeps:" |
247 // We set bodyUsed even when the body is null in spite of the | 256 // We set bodyUsed even when the body is null in spite of the |
248 // spec. See https://github.com/whatwg/fetch/issues/61 for details. | 257 // spec. See https://github.com/whatwg/fetch/issues/61 for details. |
249 if (inputRequest) { | 258 if (inputRequest) { |
250 // "1. Set |input|'s body to null." | 259 // "1. Set |input|'s body to null." |
251 inputRequest->m_request->setBuffer(new BodyStreamBuffer); | 260 inputRequest->m_request->setBuffer(new BodyStreamBuffer); |
252 // "2. Set |input|'s used flag." | 261 // "2. Set |input|'s used flag." |
253 inputRequest->setBodyPassed(); | 262 inputRequest->setBodyPassed(); |
254 } | 263 } |
255 | 264 |
256 // "32. Return |r|." | 265 // "36. Return |r|." |
257 return r; | 266 return r; |
258 } | 267 } |
259 | 268 |
260 Request* Request::create(ScriptState* scriptState, const RequestInfo& input, con
st Dictionary& init, ExceptionState& exceptionState) | 269 Request* Request::create(ScriptState* scriptState, const RequestInfo& input, con
st Dictionary& init, ExceptionState& exceptionState) |
261 { | 270 { |
262 ASSERT(!input.isNull()); | 271 ASSERT(!input.isNull()); |
263 if (input.isUSVString()) | 272 if (input.isUSVString()) |
264 return create(scriptState, input.getAsUSVString(), init, exceptionState)
; | 273 return create(scriptState, input.getAsUSVString(), init, exceptionState)
; |
265 return create(scriptState, input.getAsRequest(), init, exceptionState); | 274 return create(scriptState, input.getAsRequest(), init, exceptionState); |
266 } | 275 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 return "omit"; | 455 return "omit"; |
447 case WebURLRequest::FetchCredentialsModeSameOrigin: | 456 case WebURLRequest::FetchCredentialsModeSameOrigin: |
448 return "same-origin"; | 457 return "same-origin"; |
449 case WebURLRequest::FetchCredentialsModeInclude: | 458 case WebURLRequest::FetchCredentialsModeInclude: |
450 return "include"; | 459 return "include"; |
451 } | 460 } |
452 ASSERT_NOT_REACHED(); | 461 ASSERT_NOT_REACHED(); |
453 return ""; | 462 return ""; |
454 } | 463 } |
455 | 464 |
| 465 String Request::redirect() const |
| 466 { |
| 467 // "The redirect attribute's getter must return request's redirect mode." |
| 468 switch (m_request->redirect()) { |
| 469 case WebURLRequest::FetchRedirectModeFollow: |
| 470 return "follow"; |
| 471 case WebURLRequest::FetchRedirectModeError: |
| 472 return "error"; |
| 473 case WebURLRequest::FetchRedirectModeManual: |
| 474 return "manual"; |
| 475 } |
| 476 ASSERT_NOT_REACHED(); |
| 477 return ""; |
| 478 } |
| 479 |
456 Request* Request::clone(ExceptionState& exceptionState) | 480 Request* Request::clone(ExceptionState& exceptionState) |
457 { | 481 { |
458 if (bodyUsed()) { | 482 if (bodyUsed()) { |
459 exceptionState.throwTypeError("Request body is already used"); | 483 exceptionState.throwTypeError("Request body is already used"); |
460 return nullptr; | 484 return nullptr; |
461 } | 485 } |
462 | 486 |
463 FetchRequestData* request = m_request->clone(executionContext()); | 487 FetchRequestData* request = m_request->clone(executionContext()); |
464 Headers* headers = Headers::create(request->headerList()); | 488 Headers* headers = Headers::create(request->headerList()); |
465 headers->setGuard(m_headers->guard()); | 489 headers->setGuard(m_headers->guard()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 527 } |
504 | 528 |
505 DEFINE_TRACE(Request) | 529 DEFINE_TRACE(Request) |
506 { | 530 { |
507 Body::trace(visitor); | 531 Body::trace(visitor); |
508 visitor->trace(m_request); | 532 visitor->trace(m_request); |
509 visitor->trace(m_headers); | 533 visitor->trace(m_headers); |
510 } | 534 } |
511 | 535 |
512 } // namespace blink | 536 } // namespace blink |
OLD | NEW |