Changeset 221999 in webkit
- Timestamp:
- Sep 13, 2017 4:33:56 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r221997 r221999 1 2017-09-13 Basuke Suzuki <Basuke.Suzuki@sony.com> 2 3 [Curl] Bug fix for synchronous transfer 4 https://bugs.webkit.org/show_bug.cgi?id=176552 5 6 Reviewed by Alex Christensen. 7 8 ResourceHandleInternal::m_delegate is null when transfer is synchronous. It should be set ResourceHandleCurlDelegate. 9 Also the callback functions called when transfer is completed is wrong. 10 11 * platform/network/curl/ResourceHandleCurl.cpp: 12 (WebCore::ResourceHandle::platformLoadResourceSynchronously): 13 * platform/network/curl/ResourceHandleCurlDelegate.cpp: 14 (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob): 15 (WebCore::ResourceHandleCurlDelegate::notifyFinish): 16 (WebCore::ResourceHandleCurlDelegate::notifyFail): 17 (WebCore::ResourceHandleCurlDelegate::didReceiveHeader): 18 (WebCore::ResourceHandleCurlDelegate::didReceiveData): 19 (WebCore::ResourceHandleCurlDelegate::willSendData): 20 1 21 2017-09-13 Matt Lewis <jlewis3@apple.com> 2 22 -
trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp
r220939 r221999 231 231 } 232 232 233 // sync loader234 235 233 void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data) 236 234 { … … 240 238 RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(context, request, &client, false, false)); 241 239 240 handle->d->m_delegate = adoptRef(new ResourceHandleCurlDelegate(handle.get())); 242 241 handle->d->m_delegate->dispatchSynchronousJob(); 243 242 -
trunk/Source/WebCore/platform/network/curl/ResourceHandleCurlDelegate.cpp
r221864 r221999 172 172 setWebTimings(pretransferTime, dnsLookupTime, connectTime, appConnectTime); 173 173 174 if (m_handle->client()) { 175 if (ret != CURLE_OK) { 176 String domain = CurlContext::errorDomain; 177 int errorCode = m_curlHandle.errorCode(); 178 URL failingURL = m_curlHandle.getEffectiveURL(); 179 String errorDescription = m_curlHandle.errorDescription(); 180 unsigned sslErrors = m_curlHandle.getSslErrors(); 181 182 m_handle->client()->didFail(m_handle, ResourceError(domain, errorCode, failingURL, errorDescription, sslErrors)); 183 } else 184 m_handle->client()->didReceiveResponse(m_handle, ResourceResponse(response())); 185 } 174 if (ret != CURLE_OK) 175 notifyFail(); 176 else 177 notifyFinish(); 186 178 } 187 179 … … 292 284 m_curlHandle.getTimes(pretransferTime, dnsLookupTime, connectTime, appConnectTime); 293 285 294 callOnMainThread([protectedThis = makeRef(*this), pretransferTime, dnsLookupTime, connectTime, appConnectTime] { 295 if (!protectedThis->m_handle) 296 return; 297 protectedThis->didFinish(pretransferTime, dnsLookupTime, connectTime, appConnectTime); 298 }); 286 if (isMainThread()) 287 didFinish(pretransferTime, dnsLookupTime, connectTime, appConnectTime); 288 else { 289 callOnMainThread([protectedThis = makeRef(*this), pretransferTime, dnsLookupTime, connectTime, appConnectTime] { 290 if (!protectedThis->m_handle) 291 return; 292 protectedThis->didFinish(pretransferTime, dnsLookupTime, connectTime, appConnectTime); 293 }); 294 } 299 295 } 300 296 … … 307 303 unsigned sslErrors = m_curlHandle.getSslErrors(); 308 304 309 callOnMainThread([protectedThis = makeRef(*this), domain = domain.isolatedCopy(), errorCode, failingURL = failingURL.isolatedCopy(), errorDescription = errorDescription.isolatedCopy(), sslErrors] { 310 if (!protectedThis->m_handle) 311 return; 312 protectedThis->didFail(domain, errorCode, failingURL, errorDescription, sslErrors); 313 }); 305 if (isMainThread()) 306 didFail(domain, errorCode, failingURL, errorDescription, sslErrors); 307 else { 308 callOnMainThread([protectedThis = makeRef(*this), domain = domain.isolatedCopy(), errorCode, failingURL = failingURL.isolatedCopy(), errorDescription = errorDescription.isolatedCopy(), sslErrors] { 309 if (!protectedThis->m_handle) 310 return; 311 protectedThis->didFail(domain, errorCode, failingURL, errorDescription, sslErrors); 312 }); 313 } 314 314 } 315 315 … … 869 869 m_curlHandle.getContentLenghtDownload(contentLength); 870 870 871 callOnMainThread([protectedThis = makeRef(*this), httpCode, contentLength] { 872 if (!protectedThis->m_handle) 873 return; 874 protectedThis->didReceiveAllHeaders(httpCode, contentLength); 875 }); 871 if (isMainThread()) 872 didReceiveAllHeaders(httpCode, contentLength); 873 else { 874 callOnMainThread([protectedThis = makeRef(*this), httpCode, contentLength] { 875 if (!protectedThis->m_handle) 876 return; 877 protectedThis->didReceiveAllHeaders(httpCode, contentLength); 878 }); 879 } 876 880 } else { 877 callOnMainThread([protectedThis = makeRef(*this), header = header.isolatedCopy() ] { 878 if (!protectedThis->m_handle) 879 return; 880 protectedThis->didReceiveHeaderLine(header); 881 }); 881 if (isMainThread()) 882 didReceiveHeaderLine(header); 883 else { 884 callOnMainThread([protectedThis = makeRef(*this), header = header.isolatedCopy() ] { 885 if (!protectedThis->m_handle) 886 return; 887 protectedThis->didReceiveHeaderLine(header); 888 }); 889 } 882 890 } 883 891 … … 905 913 return 0; 906 914 907 callOnMainThread([protectedThis = makeRef(*this), data] { 908 if (!protectedThis->m_handle) 909 return; 910 protectedThis->didReceiveContentData(data); 911 }); 915 if (isMainThread()) 916 didReceiveContentData(data); 917 else { 918 callOnMainThread([protectedThis = makeRef(*this), data] { 919 if (!protectedThis->m_handle) 920 return; 921 protectedThis->didReceiveContentData(data); 922 }); 923 } 912 924 913 925 return data.size(); … … 936 948 m_sendBytes = 0; 937 949 938 callOnMainThread([protectedThis = makeRef(*this), buffer, blockSize, numberOfBlocks] { 939 if (!protectedThis->m_handle) 940 return; 941 protectedThis->prepareSendData(buffer, blockSize, numberOfBlocks); 942 }); 943 944 m_workerThreadConditionVariable.wait(lock, [this] { 945 return m_sendBytes; 946 }); 950 if (isMainThread()) 951 prepareSendData(buffer, blockSize, numberOfBlocks); 952 else { 953 callOnMainThread([protectedThis = makeRef(*this), buffer, blockSize, numberOfBlocks] { 954 if (!protectedThis->m_handle) 955 return; 956 protectedThis->prepareSendData(buffer, blockSize, numberOfBlocks); 957 }); 958 959 m_workerThreadConditionVariable.wait(lock, [this] { 960 return m_sendBytes; 961 }); 962 } 947 963 } 948 964
Note: See TracChangeset
for help on using the changeset viewer.