| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 if (!preflightResult->parse(response, accessControlErrorDescription) | 373 if (!preflightResult->parse(response, accessControlErrorDescription) |
| 374 || !preflightResult->allowsCrossOriginMethod(m_actualRequest->httpMethod
(), accessControlErrorDescription) | 374 || !preflightResult->allowsCrossOriginMethod(m_actualRequest->httpMethod
(), accessControlErrorDescription) |
| 375 || !preflightResult->allowsCrossOriginHeaders(m_actualRequest->httpHeade
rFields(), accessControlErrorDescription)) { | 375 || !preflightResult->allowsCrossOriginHeaders(m_actualRequest->httpHeade
rFields(), accessControlErrorDescription)) { |
| 376 handlePreflightFailure(response.url().string(), accessControlErrorDescri
ption); | 376 handlePreflightFailure(response.url().string(), accessControlErrorDescri
ption); |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 | 379 |
| 380 CrossOriginPreflightResultCache::shared().appendEntry(securityOrigin()->toSt
ring(), m_actualRequest->url(), preflightResult.release()); | 380 CrossOriginPreflightResultCache::shared().appendEntry(securityOrigin()->toSt
ring(), m_actualRequest->url(), preflightResult.release()); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void DocumentThreadableLoader::notifyResponseReceived(unsigned long identifier,
const ResourceResponse& response) | 383 void DocumentThreadableLoader::reportResponseReceived(unsigned long identifier,
const ResourceResponse& response) |
| 384 { | 384 { |
| 385 DocumentLoader* loader = m_document.frame()->loader().documentLoader(); | 385 DocumentLoader* loader = m_document.frame()->loader().documentLoader(); |
| 386 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Resour
ceReceiveResponse", "data", InspectorReceiveResponseEvent::data(identifier, m_do
cument.frame(), response)); | 386 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Resour
ceReceiveResponse", "data", InspectorReceiveResponseEvent::data(identifier, m_do
cument.frame(), response)); |
| 387 LocalFrame* frame = m_document.frame(); | 387 LocalFrame* frame = m_document.frame(); |
| 388 InspectorInstrumentation::didReceiveResourceResponse(frame, identifier, load
er, response, resource() ? resource()->loader() : 0); | 388 InspectorInstrumentation::didReceiveResourceResponse(frame, identifier, load
er, response, resource() ? resource()->loader() : 0); |
| 389 // It is essential that inspector gets resource response BEFORE console. | 389 // It is essential that inspector gets resource response BEFORE console. |
| 390 frame->console().reportResourceResponseReceived(loader, identifier, response
); | 390 frame->console().reportResourceResponseReceived(loader, identifier, response
); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re
sourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) | 393 void DocumentThreadableLoader::handleResponse(unsigned long identifier, const Re
sourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) |
| 394 { | 394 { |
| 395 ASSERT(m_client); | 395 ASSERT(m_client); |
| 396 | 396 |
| 397 if (m_actualRequest) { | 397 if (m_actualRequest) { |
| 398 notifyResponseReceived(identifier, response); | 398 reportResponseReceived(identifier, response); |
| 399 handlePreflightResponse(response); | 399 handlePreflightResponse(response); |
| 400 return; | 400 return; |
| 401 } | 401 } |
| 402 | 402 |
| 403 if (response.wasFetchedViaServiceWorker()) { | 403 if (response.wasFetchedViaServiceWorker()) { |
| 404 ASSERT(m_fallbackRequestForServiceWorker); | 404 ASSERT(m_fallbackRequestForServiceWorker); |
| 405 if (response.wasFallbackRequiredByServiceWorker()) { | 405 if (response.wasFallbackRequiredByServiceWorker()) { |
| 406 loadFallbackRequestForServiceWorker(); | 406 loadFallbackRequestForServiceWorker(); |
| 407 return; | 407 return; |
| 408 } | 408 } |
| 409 m_fallbackRequestForServiceWorker = nullptr; | 409 m_fallbackRequestForServiceWorker = nullptr; |
| 410 m_client->didReceiveResponse(identifier, response, handle); | 410 m_client->didReceiveResponse(identifier, response, handle); |
| 411 return; | 411 return; |
| 412 } | 412 } |
| 413 | 413 |
| 414 ASSERT(!m_fallbackRequestForServiceWorker); | 414 ASSERT(!m_fallbackRequestForServiceWorker); |
| 415 | 415 |
| 416 if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessC
ontrol) { | 416 if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessC
ontrol) { |
| 417 String accessControlErrorDescription; | 417 String accessControlErrorDescription; |
| 418 if (!passesAccessControlCheck(response, effectiveAllowCredentials(), sec
urityOrigin(), accessControlErrorDescription)) { | 418 if (!passesAccessControlCheck(response, effectiveAllowCredentials(), sec
urityOrigin(), accessControlErrorDescription)) { |
| 419 notifyResponseReceived(identifier, response); | 419 reportResponseReceived(identifier, response); |
| 420 m_client->didFailAccessControlCheck(ResourceError(errorDomainBlinkIn
ternal, 0, response.url().string(), accessControlErrorDescription)); | 420 m_client->didFailAccessControlCheck(ResourceError(errorDomainBlinkIn
ternal, 0, response.url().string(), accessControlErrorDescription)); |
| 421 return; | 421 return; |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 | 424 |
| 425 m_client->didReceiveResponse(identifier, response, handle); | 425 m_client->didReceiveResponse(identifier, response, handle); |
| 426 } | 426 } |
| 427 | 427 |
| 428 void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data
, unsigned dataLength) | 428 void DocumentThreadableLoader::dataReceived(Resource* resource, const char* data
, unsigned dataLength) |
| 429 { | 429 { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 return DoNotAllowStoredCredentials; | 610 return DoNotAllowStoredCredentials; |
| 611 return m_resourceLoaderOptions.allowCredentials; | 611 return m_resourceLoaderOptions.allowCredentials; |
| 612 } | 612 } |
| 613 | 613 |
| 614 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const | 614 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const |
| 615 { | 615 { |
| 616 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin
(); | 616 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin
(); |
| 617 } | 617 } |
| 618 | 618 |
| 619 } // namespace blink | 619 } // namespace blink |
| OLD | NEW |