Chromium Code Reviews| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 } | 473 } |
| 470 | 474 |
| 471 void DocumentThreadableLoader::handleReceivedData(const char* data, unsigned dat aLength) | 475 void DocumentThreadableLoader::handleReceivedData(const char* data, unsigned dat aLength) |
| 472 { | 476 { |
| 473 ASSERT(m_client); | 477 ASSERT(m_client); |
| 474 | 478 |
| 475 // Preflight data should be invisible to clients. | 479 // Preflight data should be invisible to clients. |
| 476 if (m_actualRequest) | 480 if (m_actualRequest) |
| 477 return; | 481 return; |
| 478 | 482 |
| 483 if (m_isUsingDataConsumerHandle) | |
| 484 return; | |
|
tyoshino (SeeGerritForStatus)
2015/05/26 08:12:01
write the reason why this should be here, not in d
yhirano
2015/05/26 08:41:03
Actually, I don't mind: either are OK. Do you thin
tyoshino (SeeGerritForStatus)
2015/05/28 05:29:55
We have handleReceivedData() factored out as a fun
yhirano
2015/05/28 05:44:37
Done.
| |
| 485 | |
| 479 ASSERT(!m_fallbackRequestForServiceWorker); | 486 ASSERT(!m_fallbackRequestForServiceWorker); |
| 480 | 487 |
| 481 m_client->didReceiveData(data, dataLength); | 488 m_client->didReceiveData(data, dataLength); |
| 482 } | 489 } |
| 483 | 490 |
| 484 void DocumentThreadableLoader::notifyFinished(Resource* resource) | 491 void DocumentThreadableLoader::notifyFinished(Resource* resource) |
| 485 { | 492 { |
| 486 ASSERT(m_client); | 493 ASSERT(m_client); |
| 487 ASSERT(resource == this->resource()); | 494 ASSERT(resource == this->resource()); |
| 488 ASSERT(m_async); | 495 ASSERT(m_async); |
| (...skipping 159 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 |