Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2677223002: Distinguish between subresource filtering and dryrun matching. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 ? MixedContentChecker::SuppressReport 812 ? MixedContentChecker::SuppressReport
813 : MixedContentChecker::SendReport; 813 : MixedContentChecker::SendReport;
814 if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url, 814 if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url,
815 mixedContentReporting)) 815 mixedContentReporting))
816 return ResourceRequestBlockedReason::MixedContent; 816 return ResourceRequestBlockedReason::MixedContent;
817 817
818 // Let the client have the final say into whether or not the load should 818 // Let the client have the final say into whether or not the load should
819 // proceed. 819 // proceed.
820 DocumentLoader* documentLoader = masterDocumentLoader(); 820 DocumentLoader* documentLoader = masterDocumentLoader();
821 if (documentLoader && documentLoader->subresourceFilter() && 821 if (documentLoader && documentLoader->subresourceFilter() &&
822 type != Resource::MainResource && type != Resource::ImportResource && 822 type != Resource::MainResource && type != Resource::ImportResource) {
823 !documentLoader->subresourceFilter()->allowLoad( 823 WebDocumentSubresourceFilter::LoadPolicy loadPolicy =
824 url, resourceRequest.requestContext())) 824 documentLoader->subresourceFilter()->getLoadPolicy(
825 return ResourceRequestBlockedReason::SubresourceFilter; 825 url, resourceRequest.requestContext());
826 if (reportingPolicy == SecurityViolationReportingPolicy::Report) {
827 switch (loadPolicy) {
828 case WebDocumentSubresourceFilter::Allow:
829 break;
830 case WebDocumentSubresourceFilter::Disallow:
831 documentLoader->subresourceFilter()->reportDisallowedLoad();
832 // fall through
833 case WebDocumentSubresourceFilter::WouldDisallow:
834 documentLoader->didObserveLoadingBehavior(
835 WebLoadingBehaviorSubresourceFilterMatch);
836 break;
837 }
838 }
839 if (loadPolicy == WebDocumentSubresourceFilter::Disallow)
840 return ResourceRequestBlockedReason::SubresourceFilter;
841 }
826 842
827 return ResourceRequestBlockedReason::None; 843 return ResourceRequestBlockedReason::None;
828 } 844 }
829 845
830 bool FrameFetchContext::isControlledByServiceWorker() const { 846 bool FrameFetchContext::isControlledByServiceWorker() const {
831 DCHECK(m_documentLoader || frame()->loader().documentLoader()); 847 DCHECK(m_documentLoader || frame()->loader().documentLoader());
832 848
833 // Service workers are bypassed by suborigins (see 849 // Service workers are bypassed by suborigins (see
834 // https://w3c.github.io/webappsec-suborigins/). Since service worker 850 // https://w3c.github.io/webappsec-suborigins/). Since service worker
835 // controllers are assigned based on physical origin, without knowledge of 851 // controllers are assigned based on physical origin, without knowledge of
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 response); 1105 response);
1090 } 1106 }
1091 1107
1092 DEFINE_TRACE(FrameFetchContext) { 1108 DEFINE_TRACE(FrameFetchContext) {
1093 visitor->trace(m_document); 1109 visitor->trace(m_document);
1094 visitor->trace(m_documentLoader); 1110 visitor->trace(m_documentLoader);
1095 FetchContext::trace(visitor); 1111 FetchContext::trace(visitor);
1096 } 1112 }
1097 1113
1098 } // namespace blink 1114 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698