| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013, Intel Corporation | 3 * Copyright (C) 2013, Intel Corporation |
| 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 are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 DocumentThreadableLoader::DocumentThreadableLoader(Document& document, Threadabl
eLoaderClient* client, BlockingBehavior blockingBehavior, const ResourceRequest&
request, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& r
esourceLoaderOptions) | 82 DocumentThreadableLoader::DocumentThreadableLoader(Document& document, Threadabl
eLoaderClient* client, BlockingBehavior blockingBehavior, const ResourceRequest&
request, const ThreadableLoaderOptions& options, const ResourceLoaderOptions& r
esourceLoaderOptions) |
| 83 : m_client(client) | 83 : m_client(client) |
| 84 , m_document(document) | 84 , m_document(document) |
| 85 , m_options(options) | 85 , m_options(options) |
| 86 , m_resourceLoaderOptions(resourceLoaderOptions) | 86 , m_resourceLoaderOptions(resourceLoaderOptions) |
| 87 , m_forceDoNotAllowStoredCredentials(false) | 87 , m_forceDoNotAllowStoredCredentials(false) |
| 88 , m_securityOrigin(m_resourceLoaderOptions.securityOrigin) | 88 , m_securityOrigin(m_resourceLoaderOptions.securityOrigin) |
| 89 , m_sameOriginRequest(securityOrigin()->canRequest(request.url())) | 89 , m_sameOriginRequest(securityOrigin()->canRequest(request.url())) |
| 90 , m_crossOriginNonSimpleRequest(false) | 90 , m_crossOriginNonSimpleRequest(false) |
| 91 , m_isUsingDataConsumerHandle(false) |
| 91 , m_async(blockingBehavior == LoadAsynchronously) | 92 , m_async(blockingBehavior == LoadAsynchronously) |
| 92 , m_requestContext(request.requestContext()) | 93 , m_requestContext(request.requestContext()) |
| 93 , m_timeoutTimer(this, &DocumentThreadableLoader::didTimeout) | 94 , m_timeoutTimer(this, &DocumentThreadableLoader::didTimeout) |
| 94 , m_requestStartedSeconds(0.0) | 95 , m_requestStartedSeconds(0.0) |
| 95 , m_corsRedirectLimit(kMaxCORSRedirects) | 96 , m_corsRedirectLimit(kMaxCORSRedirects) |
| 96 { | 97 { |
| 97 ASSERT(client); | 98 ASSERT(client); |
| 98 // Setting an outgoing referer is only supported in the async code path. | 99 // Setting an outgoing referer is only supported in the async code path. |
| 99 ASSERT(m_async || request.httpReferrer().isEmpty()); | 100 ASSERT(m_async || request.httpReferrer().isEmpty()); |
| 100 | 101 |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 ASSERT(m_async); | 367 ASSERT(m_async); |
| 367 | 368 |
| 368 m_client->didDownloadData(dataLength); | 369 m_client->didDownloadData(dataLength); |
| 369 } | 370 } |
| 370 | 371 |
| 371 void DocumentThreadableLoader::responseReceived(Resource* resource, const Resour
ceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) | 372 void DocumentThreadableLoader::responseReceived(Resource* resource, const Resour
ceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) |
| 372 { | 373 { |
| 373 ASSERT_UNUSED(resource, resource == this->resource()); | 374 ASSERT_UNUSED(resource, resource == this->resource()); |
| 374 ASSERT(m_async); | 375 ASSERT(m_async); |
| 375 | 376 |
| 377 if (handle) |
| 378 m_isUsingDataConsumerHandle = true; |
| 379 |
| 376 handleResponse(resource->identifier(), response, handle); | 380 handleResponse(resource->identifier(), response, handle); |
| 377 } | 381 } |
| 378 | 382 |
| 379 void DocumentThreadableLoader::handlePreflightResponse(const ResourceResponse& r
esponse) | 383 void DocumentThreadableLoader::handlePreflightResponse(const ResourceResponse& r
esponse) |
| 380 { | 384 { |
| 381 String accessControlErrorDescription; | 385 String accessControlErrorDescription; |
| 382 | 386 |
| 383 if (!passesAccessControlCheck(response, effectiveAllowCredentials(), securit
yOrigin(), accessControlErrorDescription)) { | 387 if (!passesAccessControlCheck(response, effectiveAllowCredentials(), securit
yOrigin(), accessControlErrorDescription)) { |
| 384 handlePreflightFailure(response.url().string(), accessControlErrorDescri
ption); | 388 handlePreflightFailure(response.url().string(), accessControlErrorDescri
ption); |
| 385 return; | 389 return; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 if (m_actualRequest) | 462 if (m_actualRequest) |
| 459 return; | 463 return; |
| 460 m_client->didReceiveCachedMetadata(data, size); | 464 m_client->didReceiveCachedMetadata(data, size); |
| 461 } | 465 } |
| 462 | 466 |
| 463 void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data
, unsigned dataLength) | 467 void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data
, unsigned dataLength) |
| 464 { | 468 { |
| 465 ASSERT_UNUSED(resource, resource == this->resource()); | 469 ASSERT_UNUSED(resource, resource == this->resource()); |
| 466 ASSERT(m_async); | 470 ASSERT(m_async); |
| 467 | 471 |
| 472 if (m_isUsingDataConsumerHandle) |
| 473 return; |
| 474 |
| 468 handleReceivedData(data, dataLength); | 475 handleReceivedData(data, dataLength); |
| 469 } | 476 } |
| 470 | 477 |
| 471 void DocumentThreadableLoader::handleReceivedData(const char* data, unsigned dat
aLength) | 478 void DocumentThreadableLoader::handleReceivedData(const char* data, unsigned dat
aLength) |
| 472 { | 479 { |
| 473 ASSERT(m_client); | 480 ASSERT(m_client); |
| 474 | 481 |
| 475 // Preflight data should be invisible to clients. | 482 // Preflight data should be invisible to clients. |
| 476 if (m_actualRequest) | 483 if (m_actualRequest) |
| 477 return; | 484 return; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 return DoNotAllowStoredCredentials; | 655 return DoNotAllowStoredCredentials; |
| 649 return m_resourceLoaderOptions.allowCredentials; | 656 return m_resourceLoaderOptions.allowCredentials; |
| 650 } | 657 } |
| 651 | 658 |
| 652 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const | 659 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const |
| 653 { | 660 { |
| 654 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin
(); | 661 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin
(); |
| 655 } | 662 } |
| 656 | 663 |
| 657 } // namespace blink | 664 } // namespace blink |
| OLD | NEW |