| 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 "FetchManager.h" | 6 #include "FetchManager.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8ThrowException.h" | 11 #include "bindings/core/v8/V8ThrowException.h" |
| 11 #include "core/dom/ExceptionCode.h" | 12 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/fileapi/Blob.h" | 13 #include "core/fileapi/Blob.h" |
| 13 #include "core/loader/ThreadableLoader.h" | 14 #include "core/loader/ThreadableLoader.h" |
| 14 #include "core/loader/ThreadableLoaderClient.h" | 15 #include "core/loader/ThreadableLoaderClient.h" |
| 15 #include "core/xml/XMLHttpRequest.h" | 16 #include "core/xml/XMLHttpRequest.h" |
| 16 #include "modules/serviceworkers/Response.h" | 17 #include "modules/serviceworkers/Response.h" |
| 17 #include "modules/serviceworkers/ResponseInit.h" | 18 #include "modules/serviceworkers/ResponseInit.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // FIXME: Set the ContentType correctly. | 79 // FIXME: Set the ContentType correctly. |
| 79 } | 80 } |
| 80 ResponseInit responseInit; | 81 ResponseInit responseInit; |
| 81 // FIXME: We may have to filter the status when we support CORS. | 82 // FIXME: We may have to filter the status when we support CORS. |
| 82 // http://fetch.spec.whatwg.org/#concept-filtered-response-opaque | 83 // http://fetch.spec.whatwg.org/#concept-filtered-response-opaque |
| 83 responseInit.status = m_response.httpStatusCode(); | 84 responseInit.status = m_response.httpStatusCode(); |
| 84 responseInit.statusText = m_response.httpStatusText(); | 85 responseInit.statusText = m_response.httpStatusText(); |
| 85 // FIXME: fill options. | 86 // FIXME: fill options. |
| 86 RefPtrWillBeRawPtr<Blob> blob = Blob::create(BlobDataHandle::create(blobData
.release(), m_downloadedBlobLength)); | 87 RefPtrWillBeRawPtr<Blob> blob = Blob::create(BlobDataHandle::create(blobData
.release(), m_downloadedBlobLength)); |
| 87 // FIXME: Handle response status correctly. | 88 // FIXME: Handle response status correctly. |
| 88 m_resolver->resolve(Response::create(blob.get(), responseInit)); | 89 NonThrowableExceptionState exceptionState; |
| 90 m_resolver->resolve(Response::create(blob.get(), responseInit, exceptionStat
e)); |
| 89 notifyFinished(); | 91 notifyFinished(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void FetchManager::Loader::didFail(const ResourceError& error) | 94 void FetchManager::Loader::didFail(const ResourceError& error) |
| 93 { | 95 { |
| 94 failed(); | 96 failed(); |
| 95 } | 97 } |
| 96 | 98 |
| 97 void FetchManager::Loader::didFailAccessControlCheck(const ResourceError& error) | 99 void FetchManager::Loader::didFailAccessControlCheck(const ResourceError& error) |
| 98 { | 100 { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 190 } |
| 189 | 191 |
| 190 bool FetchManager::isUsefulMethod(const String& method) | 192 bool FetchManager::isUsefulMethod(const String& method) |
| 191 { | 193 { |
| 192 // "A useful method is a method that is not a forbidden method." | 194 // "A useful method is a method that is not a forbidden method." |
| 193 // "A forbidden method is a method that is a byte case-insensitive match for
one of `CONNECT`, `TRACE`, and `TRACK`." | 195 // "A forbidden method is a method that is a byte case-insensitive match for
one of `CONNECT`, `TRACE`, and `TRACK`." |
| 194 return XMLHttpRequest::isAllowedHTTPMethod(method); | 196 return XMLHttpRequest::isAllowedHTTPMethod(method); |
| 195 } | 197 } |
| 196 | 198 |
| 197 } // namespace WebCore | 199 } // namespace WebCore |
| OLD | NEW |