Changeset 149253 in webkit
- Timestamp:
- Apr 27, 2013 8:38:57 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r149251 r149253 1 2013-04-27 Alexey Proskuryakov <ap@apple.com> 2 3 <rdar://problem/13757007> Crashes in NetworkResourceLoader::didReceiveResponseAsync 4 https://bugs.webkit.org/show_bug.cgi?id=115318 5 6 Reviewed by Darin Adler. 7 8 sendAbortingOnFailure may actually fail, and abort the request, making m_handle null. 9 10 * NetworkProcess/NetworkResourceLoader.cpp: 11 (WebKit::NetworkResourceLoader::didReceiveResponseAsync): Null check m_handle after 12 sending a message, because the request will cancelled when connection is invalid. 13 (WebKit::NetworkResourceLoader::didReceiveBuffer): Assert that m_handle matches 14 the handle that we are called with. 15 (WebKit::NetworkResourceLoader::didFinishLoading): Ditto. 16 (WebKit::NetworkResourceLoader::didFail): Ditto. 17 (WebKit::NetworkResourceLoader::willSendRequestAsync): Ditto. 18 (WebKit::NetworkResourceLoader::didSendData): Ditto. 19 (WebKit::NetworkResourceLoader::shouldUseCredentialStorage): Ditto. 20 (WebKit::NetworkResourceLoader::shouldUseCredentialStorageAsync): Ditto. 21 (WebKit::NetworkResourceLoader::didReceiveAuthenticationChallenge): Ditto. 22 (WebKit::NetworkResourceLoader::didCancelAuthenticationChallenge): Ditto. 23 (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync): Ditto. 24 1 25 2013-04-27 Alexey Proskuryakov <ap@apple.com> 2 26 -
trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp
r149251 r149253 147 147 } 148 148 149 void NetworkResourceLoader::didReceiveResponseAsync(ResourceHandle*, const ResourceResponse& response) 150 { 149 void NetworkResourceLoader::didReceiveResponseAsync(ResourceHandle* handle, const ResourceResponse& response) 150 { 151 ASSERT_UNUSED(handle, handle == m_handle); 152 151 153 // FIXME (NetworkProcess): Cache the response. 152 154 if (FormData* formData = request().httpBody()) … … 155 157 sendAbortingOnFailure(Messages::WebResourceLoader::DidReceiveResponseWithCertificateInfo(response, PlatformCertificateInfo(response), isLoadingMainResource())); 156 158 159 // m_handle will be 0 if the request got aborted above. 160 if (!m_handle) 161 return; 162 157 163 if (!isLoadingMainResource()) { 158 164 // For main resources, the web process is responsible for sending back a NetworkResourceLoader::ContinueDidReceiveResponse message. 159 165 m_handle->continueDidReceiveResponse(); 160 return;161 166 } 162 167 } … … 169 174 } 170 175 171 void NetworkResourceLoader::didReceiveBuffer(WebCore::ResourceHandle*, PassRefPtr<WebCore::SharedBuffer> buffer, int encodedDataLength) 172 { 176 void NetworkResourceLoader::didReceiveBuffer(ResourceHandle* handle, PassRefPtr<SharedBuffer> buffer, int encodedDataLength) 177 { 178 ASSERT_UNUSED(handle, handle == m_handle); 179 173 180 // FIXME (NetworkProcess): For the memory cache we'll also need to cache the response data here. 174 181 // Such buffering will need to be thread safe, as this callback is happening on a background thread. … … 191 198 } 192 199 193 void NetworkResourceLoader::didFinishLoading(ResourceHandle*, double finishTime) 194 { 200 void NetworkResourceLoader::didFinishLoading(ResourceHandle* handle, double finishTime) 201 { 202 ASSERT_UNUSED(handle, handle == m_handle); 203 195 204 // FIXME (NetworkProcess): For the memory cache we'll need to update the finished status of the cached resource here. 196 205 // Such bookkeeping will need to be thread safe, as this callback is happening on a background thread. … … 201 210 } 202 211 203 void NetworkResourceLoader::didFail(ResourceHandle*, const ResourceError& error) 204 { 212 void NetworkResourceLoader::didFail(ResourceHandle* handle, const ResourceError& error) 213 { 214 ASSERT_UNUSED(handle, handle == m_handle); 215 205 216 // FIXME (NetworkProcess): For the memory cache we'll need to update the finished status of the cached resource here. 206 217 // Such bookkeeping will need to be thread safe, as this callback is happening on a background thread. … … 210 221 } 211 222 212 void NetworkResourceLoader::willSendRequestAsync(ResourceHandle*, const ResourceRequest& request, const ResourceResponse& redirectResponse) 213 { 223 void NetworkResourceLoader::willSendRequestAsync(ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& redirectResponse) 224 { 225 ASSERT_UNUSED(handle, handle == m_handle); 226 214 227 // We only expect to get the willSendRequest callback from ResourceHandle as the result of a redirect. 215 228 ASSERT(!redirectResponse.isNull()); … … 243 256 } 244 257 245 void NetworkResourceLoader::didSendData(ResourceHandle*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) 246 { 258 void NetworkResourceLoader::didSendData(ResourceHandle* handle, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) 259 { 260 ASSERT_UNUSED(handle, handle == m_handle); 261 247 262 send(Messages::WebResourceLoader::DidSendData(bytesSent, totalBytesToBeSent)); 248 263 } … … 261 276 } 262 277 263 bool NetworkResourceLoader::shouldUseCredentialStorage(WebCore::ResourceHandle*) 264 { 278 bool NetworkResourceLoader::shouldUseCredentialStorage(ResourceHandle* handle) 279 { 280 ASSERT_UNUSED(handle, handle == m_handle || !m_handle); // m_handle will be 0 if called from ResourceHandle::start(). 281 265 282 // When the WebProcess is handling loading a client is consulted each time this shouldUseCredentialStorage question is asked. 266 283 // In NetworkProcess mode we ask the WebProcess client up front once and then reuse the cached answer. … … 273 290 void NetworkResourceLoader::shouldUseCredentialStorageAsync(ResourceHandle* handle) 274 291 { 292 ASSERT_UNUSED(handle, handle == m_handle); 293 275 294 handle->continueShouldUseCredentialStorage(shouldUseCredentialStorage(handle)); 276 295 } 277 296 278 void NetworkResourceLoader::didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) 279 { 297 void NetworkResourceLoader::didReceiveAuthenticationChallenge(ResourceHandle* handle, const AuthenticationChallenge& challenge) 298 { 299 ASSERT_UNUSED(handle, handle == m_handle); 300 280 301 NetworkProcess::shared().authenticationManager().didReceiveAuthenticationChallenge(webPageID(), webFrameID(), challenge); 281 302 } 282 303 283 void NetworkResourceLoader::didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) 284 { 304 void NetworkResourceLoader::didCancelAuthenticationChallenge(ResourceHandle* handle, const AuthenticationChallenge& challenge) 305 { 306 ASSERT_UNUSED(handle, handle == m_handle); 307 285 308 // This function is probably not needed (see <rdar://problem/8960124>). 286 309 notImplemented(); … … 288 311 289 312 #if USE(PROTECTION_SPACE_AUTH_CALLBACK) 290 void NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle*, const ProtectionSpace& protectionSpace) 291 { 292 ASSERT(isMainThread()); 313 void NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync(ResourceHandle* handle, const ProtectionSpace& protectionSpace) 314 { 315 ASSERT(isMainThread()); 316 ASSERT_UNUSED(handle, handle == m_handle); 293 317 294 318 // This message is DispatchMessageEvenWhenWaitingForSyncReply to avoid a situation where the NetworkProcess is deadlocked
Note: See TracChangeset
for help on using the changeset viewer.