Index: Source/core/loader/MixedContentChecker.cpp |
diff --git a/Source/core/loader/MixedContentChecker.cpp b/Source/core/loader/MixedContentChecker.cpp |
index 449058f80cec9b82bb8e0a250f6ee313b3b95c8c..c0b0e6a7b7e6206799fe5c66aeaeda0e9a14342f 100644 |
--- a/Source/core/loader/MixedContentChecker.cpp |
+++ b/Source/core/loader/MixedContentChecker.cpp |
@@ -342,6 +342,9 @@ bool MixedContentChecker::shouldBlockFetch(LocalFrame* frame, WebURLRequest::Req |
if (allowed) |
client->didDisplayInsecureContent(); |
break; |
+ case ContextTypeNotMixedContent: |
+ ASSERT_NOT_REACHED(); |
+ break; |
}; |
if (reportingStatus == SendReport) |
@@ -427,4 +430,35 @@ void MixedContentChecker::checkMixedPrivatePublic(LocalFrame* frame, const Atomi |
UseCounter::count(frame->document(), UseCounter::MixedContentPrivateHostnameInPublicHostname); |
} |
+LocalFrame* MixedContentChecker::effectiveFrameForFrameType(LocalFrame* frame, WebURLRequest::FrameType frameType) |
+{ |
+ // If we're loading the main resource of a subframe, ensure that we check |
+ // against the parent of the active frame, rather than the frame itself. |
+ LocalFrame* effectiveFrame = frame; |
+ if (frameType == WebURLRequest::FrameTypeNested) { |
+ // FIXME: Deal with RemoteFrames. |
+ Frame* parentFrame = effectiveFrame->tree().parent(); |
+ ASSERT(parentFrame); |
+ if (parentFrame->isLocalFrame()) |
+ effectiveFrame = toLocalFrame(parentFrame); |
+ } |
+ return effectiveFrame; |
+} |
+ |
+MixedContentChecker::ContextType MixedContentChecker::contextTypeForInspector(LocalFrame* frame, const ResourceRequest& request) |
+{ |
+ LocalFrame* effectiveFrame = effectiveFrameForFrameType(frame, request.frameType()); |
+ |
+ LocalFrame* mixedFrame = inWhichFrameIsContentMixed(effectiveFrame, request.frameType(), request.url()); |
+ if (!mixedFrame) |
+ return ContextTypeNotMixedContent; |
+ |
+ // See comment in shouldBlockFetch() about loading the main resource of a subframe. |
+ if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { |
+ return ContextTypeOptionallyBlockable; |
+ } |
+ |
+ return contextTypeFromContext(request.requestContext(), mixedFrame); |
+} |
+ |
} // namespace blink |