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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 // when the ServiceWorker does not call respondWith().) | 445 // when the ServiceWorker does not call respondWith().) |
446 ASSERT(m_fallbackRequestForServiceWorker); | 446 ASSERT(m_fallbackRequestForServiceWorker); |
447 loadFallbackRequestForServiceWorker(); | 447 loadFallbackRequestForServiceWorker(); |
448 return; | 448 return; |
449 } | 449 } |
450 m_fallbackRequestForServiceWorker = nullptr; | 450 m_fallbackRequestForServiceWorker = nullptr; |
451 m_client->didReceiveResponse(identifier, response, handle); | 451 m_client->didReceiveResponse(identifier, response, handle); |
452 return; | 452 return; |
453 } | 453 } |
454 | 454 |
455 ASSERT(!m_fallbackRequestForServiceWorker); | 455 // Even if the request met the conditions to get handled by a Service Worker |
456 // in the constructor of this class (and therefore | |
457 // |m_fallbackRequestForServiceWorker| is set), the Service Worker may skip | |
458 // processing the request. Only if the request is same origin, the skipped | |
459 // response may come here (wasFetchedViaServiceWorker() returns false) since | |
460 // such a request doesn't have to go through the CORS algorithm by calling | |
461 // loadFallbackRequestForServiceWorker(). | |
462 // FIXME: We should use |m_sameOriginRequest| when we will support | |
463 // Suborigins for Service Worker. | |
falken
2015/07/22 22:05:56
Can you link to a bug or make it more clear to fut
horo
2015/07/23 03:33:56
Done.
| |
464 ASSERT(!m_fallbackRequestForServiceWorker || securityOrigin()->canRequest(m_ fallbackRequestForServiceWorker->url())); | |
465 m_fallbackRequestForServiceWorker = nullptr; | |
456 | 466 |
457 if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessC ontrol) { | 467 if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessC ontrol) { |
458 String accessControlErrorDescription; | 468 String accessControlErrorDescription; |
459 if (!passesAccessControlCheck(response, effectiveAllowCredentials(), sec urityOrigin(), accessControlErrorDescription)) { | 469 if (!passesAccessControlCheck(response, effectiveAllowCredentials(), sec urityOrigin(), accessControlErrorDescription)) { |
460 reportResponseReceived(identifier, response); | 470 reportResponseReceived(identifier, response); |
461 m_client->didFailAccessControlCheck(ResourceError(errorDomainBlinkIn ternal, 0, response.url().string(), accessControlErrorDescription)); | 471 m_client->didFailAccessControlCheck(ResourceError(errorDomainBlinkIn ternal, 0, response.url().string(), accessControlErrorDescription)); |
462 return; | 472 return; |
463 } | 473 } |
464 } | 474 } |
465 | 475 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
664 return DoNotAllowStoredCredentials; | 674 return DoNotAllowStoredCredentials; |
665 return m_resourceLoaderOptions.allowCredentials; | 675 return m_resourceLoaderOptions.allowCredentials; |
666 } | 676 } |
667 | 677 |
668 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const | 678 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const |
669 { | 679 { |
670 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin (); | 680 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin (); |
671 } | 681 } |
672 | 682 |
673 } // namespace blink | 683 } // namespace blink |
OLD | NEW |