| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) | 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } | 256 } |
| 257 | 257 |
| 258 void ResourceLoader::willSendRequest(blink::WebURLLoader*, blink::WebURLRequest&
passedRequest, const blink::WebURLResponse& passedRedirectResponse) | 258 void ResourceLoader::willSendRequest(blink::WebURLLoader*, blink::WebURLRequest&
passedRequest, const blink::WebURLResponse& passedRedirectResponse) |
| 259 { | 259 { |
| 260 RefPtr<ResourceLoader> protect(this); | 260 RefPtr<ResourceLoader> protect(this); |
| 261 | 261 |
| 262 ResourceRequest& request(passedRequest.toMutableResourceRequest()); | 262 ResourceRequest& request(passedRequest.toMutableResourceRequest()); |
| 263 ASSERT(!request.isNull()); | 263 ASSERT(!request.isNull()); |
| 264 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe
sponse()); | 264 const ResourceResponse& redirectResponse(passedRedirectResponse.toResourceRe
sponse()); |
| 265 ASSERT(!redirectResponse.isNull()); | 265 ASSERT(!redirectResponse.isNull()); |
| 266 if (!m_host->shouldRequest(m_resource, request, m_options)) { | 266 if (!m_host->canAccessRedirect(m_resource, request, redirectResponse, m_opti
ons)) { |
| 267 cancel(); | 267 cancel(); |
| 268 return; | 268 return; |
| 269 } | 269 } |
| 270 |
| 270 m_host->redirectReceived(m_resource, redirectResponse); | 271 m_host->redirectReceived(m_resource, redirectResponse); |
| 271 m_resource->willSendRequest(request, redirectResponse); | 272 m_resource->willSendRequest(request, redirectResponse); |
| 272 if (request.isNull() || m_state == Terminated) | 273 if (request.isNull() || m_state == Terminated) |
| 273 return; | 274 return; |
| 274 | 275 |
| 275 m_host->willSendRequest(m_resource->identifier(), request, redirectResponse,
m_options.initiatorInfo); | 276 m_host->willSendRequest(m_resource->identifier(), request, redirectResponse,
m_options.initiatorInfo); |
| 276 request.setReportLoadTiming(true); | 277 request.setReportLoadTiming(true); |
| 277 ASSERT(!request.isNull()); | 278 ASSERT(!request.isNull()); |
| 278 m_resource->updateRequest(request); | 279 m_resource->updateRequest(request); |
| 279 m_request = request; | 280 m_request = request; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 | 315 |
| 315 if (responseNeedsAccessControlCheck()) { | 316 if (responseNeedsAccessControlCheck()) { |
| 316 // If the response successfully validated a cached resource, perform | 317 // If the response successfully validated a cached resource, perform |
| 317 // the access control with respect to it. Need to do this right here | 318 // the access control with respect to it. Need to do this right here |
| 318 // before the resource switches clients over to that validated resource. | 319 // before the resource switches clients over to that validated resource. |
| 319 Resource* resource = m_resource; | 320 Resource* resource = m_resource; |
| 320 if (resource->isCacheValidator() && resourceResponse.httpStatusCode() ==
304) | 321 if (resource->isCacheValidator() && resourceResponse.httpStatusCode() ==
304) |
| 321 resource = m_resource->resourceToRevalidate(); | 322 resource = m_resource->resourceToRevalidate(); |
| 322 else | 323 else |
| 323 m_resource->setResponse(resourceResponse); | 324 m_resource->setResponse(resourceResponse); |
| 324 if (!m_host->canAccessResource(resource, response.url())) { | 325 if (!m_host->canAccessResource(resource, m_options.securityOrigin.get(),
response.url())) { |
| 325 cancel(); | 326 cancel(); |
| 326 return; | 327 return; |
| 327 } | 328 } |
| 328 } | 329 } |
| 329 | 330 |
| 330 // Reference the object in this method since the additional processing can d
o | 331 // Reference the object in this method since the additional processing can d
o |
| 331 // anything including removing the last reference to this object. | 332 // anything including removing the last reference to this object. |
| 332 RefPtr<ResourceLoader> protect(this); | 333 RefPtr<ResourceLoader> protect(this); |
| 333 m_resource->responseReceived(resourceResponse); | 334 m_resource->responseReceived(resourceResponse); |
| 334 if (m_state == Terminated) | 335 if (m_state == Terminated) |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 didReceiveResponse(0, responseOut); | 457 didReceiveResponse(0, responseOut); |
| 457 if (m_state == Terminated) | 458 if (m_state == Terminated) |
| 458 return; | 459 return; |
| 459 RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse()
.resourceLoadInfo(); | 460 RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse()
.resourceLoadInfo(); |
| 460 m_host->didReceiveData(m_resource, dataOut.data(), dataOut.size(), resourceL
oadInfo ? resourceLoadInfo->encodedDataLength : -1); | 461 m_host->didReceiveData(m_resource, dataOut.data(), dataOut.size(), resourceL
oadInfo ? resourceLoadInfo->encodedDataLength : -1); |
| 461 m_resource->setResourceBuffer(dataOut); | 462 m_resource->setResourceBuffer(dataOut); |
| 462 didFinishLoading(0, monotonicallyIncreasingTime()); | 463 didFinishLoading(0, monotonicallyIncreasingTime()); |
| 463 } | 464 } |
| 464 | 465 |
| 465 } | 466 } |
| OLD | NEW |