| 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 forPreload ? MixedContentChecker::SuppressReport | 810 forPreload ? MixedContentChecker::SuppressReport |
| 811 : MixedContentChecker::SendReport; | 811 : MixedContentChecker::SendReport; |
| 812 if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url, | 812 if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url, |
| 813 mixedContentReporting)) | 813 mixedContentReporting)) |
| 814 return ResourceRequestBlockedReason::MixedContent; | 814 return ResourceRequestBlockedReason::MixedContent; |
| 815 | 815 |
| 816 // Let the client have the final say into whether or not the load should | 816 // Let the client have the final say into whether or not the load should |
| 817 // proceed. | 817 // proceed. |
| 818 DocumentLoader* documentLoader = masterDocumentLoader(); | 818 DocumentLoader* documentLoader = masterDocumentLoader(); |
| 819 if (documentLoader && documentLoader->subresourceFilter() && | 819 if (documentLoader && documentLoader->subresourceFilter() && |
| 820 type != Resource::MainResource && type != Resource::ImportResource && | 820 type != Resource::MainResource && type != Resource::ImportResource) { |
| 821 !documentLoader->subresourceFilter()->allowLoad( | 821 WebDocumentSubresourceFilter::LoadPolicy loadPolicy = |
| 822 url, resourceRequest.requestContext())) | 822 documentLoader->subresourceFilter()->getLoadPolicy( |
| 823 return ResourceRequestBlockedReason::SubresourceFilter; | 823 url, resourceRequest.requestContext()); |
| 824 // Only report filtering information for non preloads. |
| 825 if (!forPreload) { |
| 826 switch (loadPolicy) { |
| 827 case WebDocumentSubresourceFilter::Allow: |
| 828 break; |
| 829 case WebDocumentSubresourceFilter::Filter: |
| 830 documentLoader->subresourceFilter()->reportFilteredLoad(); |
| 831 // fall through |
| 832 case WebDocumentSubresourceFilter::AllowWouldFilter: |
| 833 documentLoader->didObserveLoadingBehavior( |
| 834 WebLoadingBehaviorSubresourceFilterMatch); |
| 835 break; |
| 836 } |
| 837 } |
| 838 if (loadPolicy == WebDocumentSubresourceFilter::Filter) |
| 839 return ResourceRequestBlockedReason::SubresourceFilter; |
| 840 } |
| 824 | 841 |
| 825 return ResourceRequestBlockedReason::None; | 842 return ResourceRequestBlockedReason::None; |
| 826 } | 843 } |
| 827 | 844 |
| 828 bool FrameFetchContext::isControlledByServiceWorker() const { | 845 bool FrameFetchContext::isControlledByServiceWorker() const { |
| 829 DCHECK(m_documentLoader || frame()->loader().documentLoader()); | 846 DCHECK(m_documentLoader || frame()->loader().documentLoader()); |
| 830 | 847 |
| 831 // Service workers are bypassed by suborigins (see | 848 // Service workers are bypassed by suborigins (see |
| 832 // https://w3c.github.io/webappsec-suborigins/). Since service worker | 849 // https://w3c.github.io/webappsec-suborigins/). Since service worker |
| 833 // controllers are assigned based on physical origin, without knowledge of | 850 // controllers are assigned based on physical origin, without knowledge of |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 response); | 1104 response); |
| 1088 } | 1105 } |
| 1089 | 1106 |
| 1090 DEFINE_TRACE(FrameFetchContext) { | 1107 DEFINE_TRACE(FrameFetchContext) { |
| 1091 visitor->trace(m_document); | 1108 visitor->trace(m_document); |
| 1092 visitor->trace(m_documentLoader); | 1109 visitor->trace(m_documentLoader); |
| 1093 FetchContext::trace(visitor); | 1110 FetchContext::trace(visitor); |
| 1094 } | 1111 } |
| 1095 | 1112 |
| 1096 } // namespace blink | 1113 } // namespace blink |
| OLD | NEW |