| 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/FetchManager.h" | 6 #include "modules/fetch/FetchManager.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| 11 #include "bindings/core/v8/V8ThrowException.h" | 11 #include "bindings/core/v8/V8ThrowException.h" |
| 12 #include "core/dom/DOMArrayBuffer.h" | 12 #include "core/dom/DOMArrayBuffer.h" |
| 13 #include "core/dom/ExceptionCode.h" | 13 #include "core/dom/ExceptionCode.h" |
| 14 #include "core/fetch/FetchUtils.h" | 14 #include "core/fetch/FetchUtils.h" |
| 15 #include "core/fileapi/Blob.h" | 15 #include "core/fileapi/Blob.h" |
| 16 #include "core/frame/csp/ContentSecurityPolicy.h" | 16 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 17 #include "core/inspector/ConsoleMessage.h" | 17 #include "core/inspector/ConsoleMessage.h" |
| 18 #include "core/loader/ThreadableLoader.h" | 18 #include "core/loader/ThreadableLoader.h" |
| 19 #include "core/loader/ThreadableLoaderClient.h" | 19 #include "core/loader/ThreadableLoaderClient.h" |
| 20 #include "modules/fetch/Body.h" | 20 #include "modules/fetch/Body.h" |
| 21 #include "modules/fetch/BodyStreamBuffer.h" | 21 #include "modules/fetch/BodyStreamBuffer.h" |
| 22 #include "modules/fetch/DataConsumerHandleUtil.h" |
| 22 #include "modules/fetch/FetchRequestData.h" | 23 #include "modules/fetch/FetchRequestData.h" |
| 23 #include "modules/fetch/Response.h" | 24 #include "modules/fetch/Response.h" |
| 24 #include "modules/fetch/ResponseInit.h" | 25 #include "modules/fetch/ResponseInit.h" |
| 25 #include "platform/network/ResourceError.h" | 26 #include "platform/network/ResourceError.h" |
| 26 #include "platform/network/ResourceRequest.h" | 27 #include "platform/network/ResourceRequest.h" |
| 27 #include "platform/network/ResourceResponse.h" | 28 #include "platform/network/ResourceResponse.h" |
| 28 #include "platform/weborigin/SecurityOrigin.h" | 29 #include "platform/weborigin/SecurityOrigin.h" |
| 29 #include "public/platform/WebURLRequest.h" | 30 #include "public/platform/WebURLRequest.h" |
| 30 #include "wtf/HashSet.h" | 31 #include "wtf/HashSet.h" |
| 31 | 32 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 break; | 105 break; |
| 105 case WebURLRequest::FetchRequestModeNoCORS: | 106 case WebURLRequest::FetchRequestModeNoCORS: |
| 106 m_request->setResponseTainting(FetchRequestData::OpaqueTainting); | 107 m_request->setResponseTainting(FetchRequestData::OpaqueTainting); |
| 107 break; | 108 break; |
| 108 case WebURLRequest::FetchRequestModeCORS: | 109 case WebURLRequest::FetchRequestModeCORS: |
| 109 case WebURLRequest::FetchRequestModeCORSWithForcedPreflight: | 110 case WebURLRequest::FetchRequestModeCORSWithForcedPreflight: |
| 110 m_request->setResponseTainting(FetchRequestData::CORSTainting); | 111 m_request->setResponseTainting(FetchRequestData::CORSTainting); |
| 111 break; | 112 break; |
| 112 } | 113 } |
| 113 } | 114 } |
| 114 FetchResponseData* responseData = FetchResponseData::createWithBuffer(BodySt
reamBuffer::create(handle, "Failed to fetch")); | 115 FetchResponseData* responseData = FetchResponseData::createWithBuffer(BodySt
reamBuffer2::create(createFetchDataConsumerHandleFromWebHandle(handle))); |
| 115 responseData->setStatus(response.httpStatusCode()); | 116 responseData->setStatus(response.httpStatusCode()); |
| 116 responseData->setStatusMessage(response.httpStatusText()); | 117 responseData->setStatusMessage(response.httpStatusText()); |
| 117 for (auto& it : response.httpHeaderFields()) | 118 for (auto& it : response.httpHeaderFields()) |
| 118 responseData->headerList()->append(it.key, it.value); | 119 responseData->headerList()->append(it.key, it.value); |
| 119 responseData->setURL(response.url()); | 120 responseData->setURL(response.url()); |
| 120 responseData->setMIMEType(response.mimeType()); | 121 responseData->setMIMEType(response.mimeType()); |
| 121 | 122 |
| 122 FetchResponseData* taintedResponse = responseData; | 123 FetchResponseData* taintedResponse = responseData; |
| 123 switch (m_request->tainting()) { | 124 switch (m_request->tainting()) { |
| 124 case FetchRequestData::BasicTainting: | 125 case FetchRequestData::BasicTainting: |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 449 |
| 449 DEFINE_TRACE(FetchManager) | 450 DEFINE_TRACE(FetchManager) |
| 450 { | 451 { |
| 451 #if ENABLE(OILPAN) | 452 #if ENABLE(OILPAN) |
| 452 visitor->trace(m_executionContext); | 453 visitor->trace(m_executionContext); |
| 453 visitor->trace(m_loaders); | 454 visitor->trace(m_loaders); |
| 454 #endif | 455 #endif |
| 455 } | 456 } |
| 456 | 457 |
| 457 } // namespace blink | 458 } // namespace blink |
| OLD | NEW |