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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 RELEASE_ASSERT(m_connectionState == ConnectionStateNew); | 506 RELEASE_ASSERT(m_connectionState == ConnectionStateNew); |
507 m_connectionState = ConnectionStateStarted; | 507 m_connectionState = ConnectionStateStarted; |
508 | 508 |
509 WrappedResourceRequest requestIn(m_request); | 509 WrappedResourceRequest requestIn(m_request); |
510 WebURLResponse responseOut; | 510 WebURLResponse responseOut; |
511 responseOut.initialize(); | 511 responseOut.initialize(); |
512 WebURLError errorOut; | 512 WebURLError errorOut; |
513 WebData dataOut; | 513 WebData dataOut; |
514 loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut); | 514 loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut); |
515 if (errorOut.reason) { | 515 if (errorOut.reason) { |
| 516 if (m_state == Terminated) { |
| 517 // A message dispatched while synchronously fetching the resource |
| 518 // can bring about the cancellation of this load. |
| 519 ASSERT(!m_resource); |
| 520 return; |
| 521 } |
516 didFail(0, errorOut); | 522 didFail(0, errorOut); |
517 return; | 523 return; |
518 } | 524 } |
519 didReceiveResponse(0, responseOut); | 525 didReceiveResponse(0, responseOut); |
520 if (m_state == Terminated) | 526 if (m_state == Terminated) |
521 return; | 527 return; |
522 RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse()
.resourceLoadInfo(); | 528 RefPtr<ResourceLoadInfo> resourceLoadInfo = responseOut.toResourceResponse()
.resourceLoadInfo(); |
523 int64_t encodedDataLength = resourceLoadInfo ? resourceLoadInfo->encodedData
Length : WebURLLoaderClient::kUnknownEncodedDataLength; | 529 int64_t encodedDataLength = resourceLoadInfo ? resourceLoadInfo->encodedData
Length : WebURLLoaderClient::kUnknownEncodedDataLength; |
524 m_host->didReceiveData(m_resource, dataOut.data(), dataOut.size(), encodedDa
taLength); | 530 m_host->didReceiveData(m_resource, dataOut.data(), dataOut.size(), encodedDa
taLength); |
525 m_resource->setResourceBuffer(dataOut); | 531 m_resource->setResourceBuffer(dataOut); |
526 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); | 532 didFinishLoading(0, monotonicallyIncreasingTime(), encodedDataLength); |
527 } | 533 } |
528 | 534 |
529 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const | 535 ResourceRequest& ResourceLoader::applyOptions(ResourceRequest& request) const |
530 { | 536 { |
531 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); | 537 request.setAllowStoredCredentials(m_options.allowCredentials == AllowStoredC
redentials); |
532 return request; | 538 return request; |
533 } | 539 } |
534 | 540 |
535 } | 541 } |
OLD | NEW |