| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/loader/FrameFetchContext.h" | 31 #include "core/loader/FrameFetchContext.h" |
| 32 | 32 |
| 33 #include <algorithm> |
| 34 #include <memory> |
| 33 #include "bindings/core/v8/ScriptController.h" | 35 #include "bindings/core/v8/ScriptController.h" |
| 34 #include "bindings/core/v8/V8DOMActivityLogger.h" | 36 #include "bindings/core/v8/V8DOMActivityLogger.h" |
| 35 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
| 36 #include "core/frame/Deprecation.h" | 38 #include "core/frame/Deprecation.h" |
| 37 #include "core/frame/FrameConsole.h" | 39 #include "core/frame/FrameConsole.h" |
| 38 #include "core/frame/FrameHost.h" | 40 #include "core/frame/FrameHost.h" |
| 39 #include "core/frame/FrameView.h" | 41 #include "core/frame/FrameView.h" |
| 40 #include "core/frame/LocalDOMWindow.h" | 42 #include "core/frame/LocalDOMWindow.h" |
| 41 #include "core/frame/LocalFrame.h" | 43 #include "core/frame/LocalFrame.h" |
| 42 #include "core/frame/Settings.h" | 44 #include "core/frame/Settings.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 71 #include "platform/loader/fetch/ResourceLoadingLog.h" | 73 #include "platform/loader/fetch/ResourceLoadingLog.h" |
| 72 #include "platform/loader/fetch/UniqueIdentifier.h" | 74 #include "platform/loader/fetch/UniqueIdentifier.h" |
| 73 #include "platform/mhtml/MHTMLArchive.h" | 75 #include "platform/mhtml/MHTMLArchive.h" |
| 74 #include "platform/network/NetworkUtils.h" | 76 #include "platform/network/NetworkUtils.h" |
| 75 #include "platform/network/ResourceLoadPriority.h" | 77 #include "platform/network/ResourceLoadPriority.h" |
| 76 #include "platform/network/ResourceTimingInfo.h" | 78 #include "platform/network/ResourceTimingInfo.h" |
| 77 #include "platform/weborigin/SchemeRegistry.h" | 79 #include "platform/weborigin/SchemeRegistry.h" |
| 78 #include "platform/weborigin/SecurityPolicy.h" | 80 #include "platform/weborigin/SecurityPolicy.h" |
| 79 #include "public/platform/WebCachePolicy.h" | 81 #include "public/platform/WebCachePolicy.h" |
| 80 #include "public/platform/WebDocumentSubresourceFilter.h" | 82 #include "public/platform/WebDocumentSubresourceFilter.h" |
| 83 #include "public/platform/WebDocumentSubresourceFilterLoadPolicy.h" |
| 81 #include "public/platform/WebInsecureRequestPolicy.h" | 84 #include "public/platform/WebInsecureRequestPolicy.h" |
| 82 #include "public/platform/WebViewScheduler.h" | 85 #include "public/platform/WebViewScheduler.h" |
| 83 #include "wtf/Vector.h" | 86 #include "wtf/Vector.h" |
| 84 #include <algorithm> | |
| 85 #include <memory> | |
| 86 | 87 |
| 87 namespace blink { | 88 namespace blink { |
| 88 | 89 |
| 89 namespace { | 90 namespace { |
| 90 | 91 |
| 91 void emitWarningForDocWriteScripts(const String& url, Document& document) { | 92 void emitWarningForDocWriteScripts(const String& url, Document& document) { |
| 92 String message = | 93 String message = |
| 93 "A Parser-blocking, cross site (i.e. different eTLD+1) script, " + url + | 94 "A Parser-blocking, cross site (i.e. different eTLD+1) script, " + url + |
| 94 ", is invoked via document.write. This MAY be blocked by " | 95 ", is invoked via document.write. This MAY be blocked by " |
| 95 "the browser in this or a future page load due to poor network " | 96 "the browser in this or a future page load due to poor network " |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 : MixedContentChecker::SendReport; | 814 : MixedContentChecker::SendReport; |
| 814 if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url, | 815 if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url, |
| 815 mixedContentReporting)) | 816 mixedContentReporting)) |
| 816 return ResourceRequestBlockedReason::MixedContent; | 817 return ResourceRequestBlockedReason::MixedContent; |
| 817 | 818 |
| 818 // Let the client have the final say into whether or not the load should | 819 // Let the client have the final say into whether or not the load should |
| 819 // proceed. | 820 // proceed. |
| 820 DocumentLoader* documentLoader = masterDocumentLoader(); | 821 DocumentLoader* documentLoader = masterDocumentLoader(); |
| 821 if (documentLoader && documentLoader->subresourceFilter() && | 822 if (documentLoader && documentLoader->subresourceFilter() && |
| 822 type != Resource::MainResource && type != Resource::ImportResource) { | 823 type != Resource::MainResource && type != Resource::ImportResource) { |
| 823 WebDocumentSubresourceFilter::LoadPolicy loadPolicy = | 824 WebDocumentSubresourceFilterLoadPolicy loadPolicy = |
| 824 documentLoader->subresourceFilter()->getLoadPolicy( | 825 documentLoader->subresourceFilter()->getLoadPolicy( |
| 825 url, resourceRequest.requestContext()); | 826 url, resourceRequest.requestContext()); |
| 826 if (reportingPolicy == SecurityViolationReportingPolicy::Report) { | 827 if (reportingPolicy == SecurityViolationReportingPolicy::Report) { |
| 827 switch (loadPolicy) { | 828 switch (loadPolicy) { |
| 828 case WebDocumentSubresourceFilter::Allow: | 829 case WebDocumentSubresourceFilterLoadPolicy::Allow: |
| 829 break; | 830 break; |
| 830 case WebDocumentSubresourceFilter::Disallow: | 831 case WebDocumentSubresourceFilterLoadPolicy::Disallow: |
| 831 documentLoader->subresourceFilter()->reportDisallowedLoad(); | 832 documentLoader->subresourceFilter()->reportDisallowedLoad(); |
| 832 // fall through | 833 // fall through |
| 833 case WebDocumentSubresourceFilter::WouldDisallow: | 834 case WebDocumentSubresourceFilterLoadPolicy::WouldDisallow: |
| 834 documentLoader->didObserveLoadingBehavior( | 835 documentLoader->didObserveLoadingBehavior( |
| 835 WebLoadingBehaviorSubresourceFilterMatch); | 836 WebLoadingBehaviorSubresourceFilterMatch); |
| 836 break; | 837 break; |
| 837 } | 838 } |
| 838 } | 839 } |
| 839 if (loadPolicy == WebDocumentSubresourceFilter::Disallow) | 840 if (loadPolicy == WebDocumentSubresourceFilterLoadPolicy::Disallow) |
| 840 return ResourceRequestBlockedReason::SubresourceFilter; | 841 return ResourceRequestBlockedReason::SubresourceFilter; |
| 841 } | 842 } |
| 842 | 843 |
| 843 return ResourceRequestBlockedReason::None; | 844 return ResourceRequestBlockedReason::None; |
| 844 } | 845 } |
| 845 | 846 |
| 846 bool FrameFetchContext::isControlledByServiceWorker() const { | 847 bool FrameFetchContext::isControlledByServiceWorker() const { |
| 847 DCHECK(m_documentLoader || frame()->loader().documentLoader()); | 848 DCHECK(m_documentLoader || frame()->loader().documentLoader()); |
| 848 | 849 |
| 849 // Service workers are bypassed by suborigins (see | 850 // Service workers are bypassed by suborigins (see |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 response); | 1106 response); |
| 1106 } | 1107 } |
| 1107 | 1108 |
| 1108 DEFINE_TRACE(FrameFetchContext) { | 1109 DEFINE_TRACE(FrameFetchContext) { |
| 1109 visitor->trace(m_document); | 1110 visitor->trace(m_document); |
| 1110 visitor->trace(m_documentLoader); | 1111 visitor->trace(m_documentLoader); |
| 1111 FetchContext::trace(visitor); | 1112 FetchContext::trace(visitor); |
| 1112 } | 1113 } |
| 1113 | 1114 |
| 1114 } // namespace blink | 1115 } // namespace blink |
| OLD | NEW |