Chromium Code Reviews| Index: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
| diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
| index 5c636ca93c8302350ff3ae426650a4db62c83afc..d67d5ca2d8d47af60b0f5e2a760f6377cd1769d0 100644 |
| --- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
| +++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp |
| @@ -35,6 +35,7 @@ |
| #include "bindings/core/v8/ScriptController.h" |
| #include "bindings/core/v8/V8DOMActivityLogger.h" |
| #include "core/dom/Document.h" |
| +#include "core/frame/ContentSettingsClient.h" |
| #include "core/frame/Deprecation.h" |
| #include "core/frame/FrameConsole.h" |
| #include "core/frame/FrameView.h" |
| @@ -334,6 +335,10 @@ LocalFrameClient* FrameFetchContext::localFrameClient() const { |
| return frame()->client(); |
| } |
| +ContentSettingsClient* FrameFetchContext::contentSettingsClient() const { |
| + return frame() ? frame()->contentSettingsClient() : nullptr; |
|
haraken
2017/04/04 11:25:32
Can frame() be null? localFrameClient() assumes th
kinuko
2017/04/04 14:50:56
I removed the null check. I'd like to keep this m
|
| +} |
| + |
| void FrameFetchContext::addAdditionalRequestHeaders(ResourceRequest& request, |
| FetchResourceType type) { |
| bool isMainResource = type == FetchMainResource; |
| @@ -641,7 +646,7 @@ void FrameFetchContext::addResourceTiming(const ResourceTimingInfo& info) { |
| } |
| bool FrameFetchContext::allowImage(bool imagesEnabled, const KURL& url) const { |
| - return localFrameClient()->allowImage(imagesEnabled, url); |
| + return contentSettingsClient()->allowImage(imagesEnabled, url); |
| } |
| void FrameFetchContext::printAccessDeniedMessage(const KURL& url) const { |
| @@ -776,10 +781,10 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal( |
| if (type == Resource::Script || type == Resource::ImportResource) { |
| DCHECK(frame()); |
| - if (!localFrameClient()->allowScriptFromSource( |
| + if (!contentSettingsClient()->allowScriptFromSource( |
| !frame()->settings() || frame()->settings()->getScriptEnabled(), |
| url)) { |
| - localFrameClient()->didNotAllowScript(); |
| + contentSettingsClient()->didNotAllowScript(); |
| // TODO(estark): Use a different ResourceRequestBlockedReason here, since |
| // this check has nothing to do with CSP. https://crbug.com/600795 |
| return ResourceRequestBlockedReason::CSP; |