OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
586 // Let the client have the final say into whether or not the load should pro ceed. | 586 // Let the client have the final say into whether or not the load should pro ceed. |
587 DocumentLoader* documentLoader = masterDocumentLoader(); | 587 DocumentLoader* documentLoader = masterDocumentLoader(); |
588 if (documentLoader && documentLoader->subresourceFilter() && type != Resourc e::MainResource && type != Resource::ImportResource && !documentLoader->subresou rceFilter()->allowLoad(url, resourceRequest.requestContext())) | 588 if (documentLoader && documentLoader->subresourceFilter() && type != Resourc e::MainResource && type != Resource::ImportResource && !documentLoader->subresou rceFilter()->allowLoad(url, resourceRequest.requestContext())) |
589 return ResourceRequestBlockedReasonSubresourceFilter; | 589 return ResourceRequestBlockedReasonSubresourceFilter; |
590 | 590 |
591 return ResourceRequestBlockedReasonNone; | 591 return ResourceRequestBlockedReasonNone; |
592 } | 592 } |
593 | 593 |
594 bool FrameFetchContext::isControlledByServiceWorker() const | 594 bool FrameFetchContext::isControlledByServiceWorker() const |
595 { | 595 { |
596 ASSERT(m_documentLoader || frame()->loader().documentLoader()); | 596 ASSERT(m_documentLoader || frame()->loader().documentLoader()); |
Yoav Weiss
2016/09/21 15:13:09
I think you'd need to rebase as this is already DC
jww
2016/09/21 16:38:12
Done.
| |
597 | |
598 // Service workers are bypassed by suborigins (see | |
599 // https://w3c.github.io/webappsec-suborigins/). Since service worker | |
600 // controllers are assigned based on physical origin, without knowledge of | |
601 // whether the context is in a suborigin, it is necessary to explicitly | |
602 // bypass service workers on a per-request basis. Additionally, it is | |
603 // necessary to explicitly return |false| here so that it is clear that the | |
604 // SW will be bypassed. In particular, this is important for | |
605 // ResourceFetcher::getCacheIdentifier(), which will return the SW's cache | |
606 // if the context's isControlledByServiceWorker() returns |true|, and thus | |
607 // will returned cached resources from the service worker. That would have | |
608 // the effect of not bypassing the SW. | |
609 if (getSecurityOrigin() && getSecurityOrigin()->hasSuborigin()) | |
610 return false; | |
611 | |
597 if (m_documentLoader) | 612 if (m_documentLoader) |
598 return frame()->loader().client()->isControlledByServiceWorker(*m_docume ntLoader); | 613 return frame()->loader().client()->isControlledByServiceWorker(*m_docume ntLoader); |
599 // m_documentLoader is null while loading resources from an HTML import. | 614 // m_documentLoader is null while loading resources from an HTML import. |
600 // In such cases whether the request is controlled by ServiceWorker or not | 615 // In such cases whether the request is controlled by ServiceWorker or not |
601 // is determined by the document loader of the frame. | 616 // is determined by the document loader of the frame. |
602 return frame()->loader().client()->isControlledByServiceWorker(*frame()->loa der().documentLoader()); | 617 return frame()->loader().client()->isControlledByServiceWorker(*frame()->loa der().documentLoader()); |
603 } | 618 } |
604 | 619 |
605 int64_t FrameFetchContext::serviceWorkerID() const | 620 int64_t FrameFetchContext::serviceWorkerID() const |
606 { | 621 { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 } | 814 } |
800 | 815 |
801 DEFINE_TRACE(FrameFetchContext) | 816 DEFINE_TRACE(FrameFetchContext) |
802 { | 817 { |
803 visitor->trace(m_document); | 818 visitor->trace(m_document); |
804 visitor->trace(m_documentLoader); | 819 visitor->trace(m_documentLoader); |
805 FetchContext::trace(visitor); | 820 FetchContext::trace(visitor); |
806 } | 821 } |
807 | 822 |
808 } // namespace blink | 823 } // namespace blink |
OLD | NEW |