| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "web/WebAssociatedURLLoaderImpl.h" | 31 #include "core/exported/WebAssociatedURLLoaderImpl.h" |
| 32 | 32 |
| 33 #include <limits.h> | 33 #include <limits.h> |
| 34 #include <memory> | 34 #include <memory> |
| 35 #include "core/dom/ContextLifecycleObserver.h" | 35 #include "core/dom/ContextLifecycleObserver.h" |
| 36 #include "core/dom/Document.h" |
| 36 #include "core/dom/TaskRunnerHelper.h" | 37 #include "core/dom/TaskRunnerHelper.h" |
| 37 #include "core/loader/DocumentThreadableLoader.h" | 38 #include "core/loader/DocumentThreadableLoader.h" |
| 38 #include "core/loader/DocumentThreadableLoaderClient.h" | 39 #include "core/loader/DocumentThreadableLoaderClient.h" |
| 39 #include "core/loader/ThreadableLoadingContext.h" | 40 #include "core/loader/ThreadableLoadingContext.h" |
| 40 #include "platform/Timer.h" | 41 #include "platform/Timer.h" |
| 41 #include "platform/exported/WrappedResourceRequest.h" | 42 #include "platform/exported/WrappedResourceRequest.h" |
| 42 #include "platform/exported/WrappedResourceResponse.h" | 43 #include "platform/exported/WrappedResourceResponse.h" |
| 43 #include "platform/loader/fetch/CrossOriginAccessControl.h" | 44 #include "platform/loader/fetch/CrossOriginAccessControl.h" |
| 44 #include "platform/loader/fetch/FetchUtils.h" | 45 #include "platform/loader/fetch/FetchUtils.h" |
| 45 #include "platform/loader/fetch/ResourceError.h" | 46 #include "platform/loader/fetch/ResourceError.h" |
| 46 #include "platform/network/HTTPParsers.h" | 47 #include "platform/network/HTTPParsers.h" |
| 47 #include "platform/wtf/HashSet.h" | 48 #include "platform/wtf/HashSet.h" |
| 48 #include "platform/wtf/PtrUtil.h" | 49 #include "platform/wtf/PtrUtil.h" |
| 49 #include "platform/wtf/text/WTFString.h" | 50 #include "platform/wtf/text/WTFString.h" |
| 50 #include "public/platform/WebHTTPHeaderVisitor.h" | 51 #include "public/platform/WebHTTPHeaderVisitor.h" |
| 51 #include "public/platform/WebString.h" | 52 #include "public/platform/WebString.h" |
| 52 #include "public/platform/WebURLError.h" | 53 #include "public/platform/WebURLError.h" |
| 53 #include "public/platform/WebURLRequest.h" | 54 #include "public/platform/WebURLRequest.h" |
| 54 #include "public/web/WebAssociatedURLLoaderClient.h" | 55 #include "public/web/WebAssociatedURLLoaderClient.h" |
| 55 #include "public/web/WebDataSource.h" | 56 #include "public/web/WebDataSource.h" |
| 56 #include "web/WebLocalFrameImpl.h" | |
| 57 | 57 |
| 58 namespace blink { | 58 namespace blink { |
| 59 | 59 |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { | 62 class HTTPRequestHeaderValidator : public WebHTTPHeaderVisitor { |
| 63 WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator); | 63 WTF_MAKE_NONCOPYABLE(HTTPRequestHeaderValidator); |
| 64 | 64 |
| 65 public: | 65 public: |
| 66 HTTPRequestHeaderValidator() : is_safe_(true) {} | 66 HTTPRequestHeaderValidator() : is_safe_(true) {} |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 if (parent_) | 330 if (parent_) |
| 331 parent_->DocumentDestroyed(); | 331 parent_->DocumentDestroyed(); |
| 332 } | 332 } |
| 333 | 333 |
| 334 DEFINE_INLINE_VIRTUAL_TRACE() { ContextLifecycleObserver::Trace(visitor); } | 334 DEFINE_INLINE_VIRTUAL_TRACE() { ContextLifecycleObserver::Trace(visitor); } |
| 335 | 335 |
| 336 WebAssociatedURLLoaderImpl* parent_; | 336 WebAssociatedURLLoaderImpl* parent_; |
| 337 }; | 337 }; |
| 338 | 338 |
| 339 WebAssociatedURLLoaderImpl::WebAssociatedURLLoaderImpl( | 339 WebAssociatedURLLoaderImpl::WebAssociatedURLLoaderImpl( |
| 340 WebLocalFrameImpl* frame_impl, | 340 Document* document, |
| 341 const WebAssociatedURLLoaderOptions& options) | 341 const WebAssociatedURLLoaderOptions& options) |
| 342 : client_(nullptr), | 342 : client_(nullptr), |
| 343 options_(options), | 343 options_(options), |
| 344 observer_(new Observer(this, frame_impl->GetFrame()->GetDocument())) {} | 344 observer_(new Observer(this, document)) {} |
| 345 | 345 |
| 346 WebAssociatedURLLoaderImpl::~WebAssociatedURLLoaderImpl() { | 346 WebAssociatedURLLoaderImpl::~WebAssociatedURLLoaderImpl() { |
| 347 Cancel(); | 347 Cancel(); |
| 348 } | 348 } |
| 349 | 349 |
| 350 #define STATIC_ASSERT_ENUM(a, b) \ | 350 #define STATIC_ASSERT_ENUM(a, b) \ |
| 351 static_assert(static_cast<int>(a) == static_cast<int>(b), \ | 351 static_assert(static_cast<int>(a) == static_cast<int>(b), \ |
| 352 "mismatching enum: " #a) | 352 "mismatching enum: " #a) |
| 353 | 353 |
| 354 STATIC_ASSERT_ENUM(WebAssociatedURLLoaderOptions::kCrossOriginRequestPolicyDeny, | 354 STATIC_ASSERT_ENUM(WebAssociatedURLLoaderOptions::kCrossOriginRequestPolicyDeny, |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 // there could be a WebURLLoader instance behind the | 499 // there could be a WebURLLoader instance behind the |
| 500 // DocumentThreadableLoader instance. So, for safety, we chose to just | 500 // DocumentThreadableLoader instance. So, for safety, we chose to just |
| 501 // crash here. | 501 // crash here. |
| 502 CHECK(ThreadState::Current()); | 502 CHECK(ThreadState::Current()); |
| 503 | 503 |
| 504 observer_->Dispose(); | 504 observer_->Dispose(); |
| 505 observer_ = nullptr; | 505 observer_ = nullptr; |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace blink | 508 } // namespace blink |
| OLD | NEW |