| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> | 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> |
| 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> | 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> |
| 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. |
| 6 * Copyright (C) 2012 Intel Corporation | 6 * Copyright (C) 2012 Intel Corporation |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace | 161 } // namespace |
| 162 | 162 |
| 163 class XMLHttpRequest::BlobLoader final : public GarbageCollectedFinalized<XMLHtt
pRequest::BlobLoader>, public FileReaderLoaderClient { | 163 class XMLHttpRequest::BlobLoader final : public GarbageCollectedFinalized<XMLHtt
pRequest::BlobLoader>, public FileReaderLoaderClient { |
| 164 public: | 164 public: |
| 165 static BlobLoader* create(XMLHttpRequest* xhr, PassRefPtr<BlobDataHandle> ha
ndle) | 165 static BlobLoader* create(XMLHttpRequest* xhr, PassRefPtr<BlobDataHandle> ha
ndle) |
| 166 { | 166 { |
| 167 return new BlobLoader(xhr, handle); | 167 return new BlobLoader(xhr, std::move(handle)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 // FileReaderLoaderClient functions. | 170 // FileReaderLoaderClient functions. |
| 171 void didStartLoading() override {} | 171 void didStartLoading() override {} |
| 172 void didReceiveDataForClient(const char* data, unsigned length) override | 172 void didReceiveDataForClient(const char* data, unsigned length) override |
| 173 { | 173 { |
| 174 ASSERT(length <= INT_MAX); | 174 ASSERT(length <= INT_MAX); |
| 175 m_xhr->didReceiveData(data, length); | 175 m_xhr->didReceiveData(data, length); |
| 176 } | 176 } |
| 177 void didFinishLoading() override | 177 void didFinishLoading() override |
| (...skipping 13 matching lines...) Expand all Loading... |
| 191 DEFINE_INLINE_TRACE() | 191 DEFINE_INLINE_TRACE() |
| 192 { | 192 { |
| 193 visitor->trace(m_xhr); | 193 visitor->trace(m_xhr); |
| 194 } | 194 } |
| 195 | 195 |
| 196 private: | 196 private: |
| 197 BlobLoader(XMLHttpRequest* xhr, PassRefPtr<BlobDataHandle> handle) | 197 BlobLoader(XMLHttpRequest* xhr, PassRefPtr<BlobDataHandle> handle) |
| 198 : m_xhr(xhr) | 198 : m_xhr(xhr) |
| 199 , m_loader(FileReaderLoader::create(FileReaderLoader::ReadByClient, this
)) | 199 , m_loader(FileReaderLoader::create(FileReaderLoader::ReadByClient, this
)) |
| 200 { | 200 { |
| 201 m_loader->start(m_xhr->getExecutionContext(), handle); | 201 m_loader->start(m_xhr->getExecutionContext(), std::move(handle)); |
| 202 } | 202 } |
| 203 | 203 |
| 204 Member<XMLHttpRequest> m_xhr; | 204 Member<XMLHttpRequest> m_xhr; |
| 205 std::unique_ptr<FileReaderLoader> m_loader; | 205 std::unique_ptr<FileReaderLoader> m_loader; |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 XMLHttpRequest* XMLHttpRequest::create(ScriptState* scriptState) | 208 XMLHttpRequest* XMLHttpRequest::create(ScriptState* scriptState) |
| 209 { | 209 { |
| 210 ExecutionContext* context = scriptState->getExecutionContext(); | 210 ExecutionContext* context = scriptState->getExecutionContext(); |
| 211 DOMWrapperWorld& world = scriptState->world(); | 211 DOMWrapperWorld& world = scriptState->world(); |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 request.setRequestContext(WebURLRequest::RequestContextXMLHttpRequest); | 905 request.setRequestContext(WebURLRequest::RequestContextXMLHttpRequest); |
| 906 request.setFetchCredentialsMode(m_includeCredentials ? WebURLRequest::FetchC
redentialsModeInclude : WebURLRequest::FetchCredentialsModeSameOrigin); | 906 request.setFetchCredentialsMode(m_includeCredentials ? WebURLRequest::FetchC
redentialsModeInclude : WebURLRequest::FetchCredentialsModeSameOrigin); |
| 907 request.setSkipServiceWorker(m_isolatedWorldSecurityOrigin.get() ? WebURLReq
uest::SkipServiceWorker::All : WebURLRequest::SkipServiceWorker::None); | 907 request.setSkipServiceWorker(m_isolatedWorldSecurityOrigin.get() ? WebURLReq
uest::SkipServiceWorker::All : WebURLRequest::SkipServiceWorker::None); |
| 908 request.setExternalRequestStateFromRequestorAddressSpace(executionContext.se
curityContext().addressSpace()); | 908 request.setExternalRequestStateFromRequestorAddressSpace(executionContext.se
curityContext().addressSpace()); |
| 909 | 909 |
| 910 InspectorInstrumentation::willLoadXHR(&executionContext, this, this, m_metho
d, m_url, m_async, httpBody ? httpBody->deepCopy() : nullptr, m_requestHeaders,
m_includeCredentials); | 910 InspectorInstrumentation::willLoadXHR(&executionContext, this, this, m_metho
d, m_url, m_async, httpBody ? httpBody->deepCopy() : nullptr, m_requestHeaders,
m_includeCredentials); |
| 911 | 911 |
| 912 if (httpBody) { | 912 if (httpBody) { |
| 913 ASSERT(m_method != HTTPNames::GET); | 913 ASSERT(m_method != HTTPNames::GET); |
| 914 ASSERT(m_method != HTTPNames::HEAD); | 914 ASSERT(m_method != HTTPNames::HEAD); |
| 915 request.setHTTPBody(httpBody); | 915 request.setHTTPBody(std::move(httpBody)); |
| 916 } | 916 } |
| 917 | 917 |
| 918 if (m_requestHeaders.size() > 0) | 918 if (m_requestHeaders.size() > 0) |
| 919 request.addHTTPHeaderFields(m_requestHeaders); | 919 request.addHTTPHeaderFields(m_requestHeaders); |
| 920 | 920 |
| 921 ThreadableLoaderOptions options; | 921 ThreadableLoaderOptions options; |
| 922 options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight; | 922 options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight; |
| 923 options.crossOriginRequestPolicy = UseAccessControl; | 923 options.crossOriginRequestPolicy = UseAccessControl; |
| 924 options.initiator = FetchInitiatorTypeNames::xmlhttprequest; | 924 options.initiator = FetchInitiatorTypeNames::xmlhttprequest; |
| 925 options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypa
ssMainWorld(&executionContext) ? DoNotEnforceContentSecurityPolicy : EnforceCont
entSecurityPolicy; | 925 options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypa
ssMainWorld(&executionContext) ? DoNotEnforceContentSecurityPolicy : EnforceCont
entSecurityPolicy; |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 visitor->traceWrappers(m_responseDocument); | 1744 visitor->traceWrappers(m_responseDocument); |
| 1745 visitor->traceWrappers(m_responseArrayBuffer); | 1745 visitor->traceWrappers(m_responseArrayBuffer); |
| 1746 } | 1746 } |
| 1747 | 1747 |
| 1748 std::ostream& operator<<(std::ostream& ostream, const XMLHttpRequest* xhr) | 1748 std::ostream& operator<<(std::ostream& ostream, const XMLHttpRequest* xhr) |
| 1749 { | 1749 { |
| 1750 return ostream << "XMLHttpRequest " << static_cast<const void*>(xhr); | 1750 return ostream << "XMLHttpRequest " << static_cast<const void*>(xhr); |
| 1751 } | 1751 } |
| 1752 | 1752 |
| 1753 } // namespace blink | 1753 } // namespace blink |
| OLD | NEW |