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

Unified Diff: Source/core/loader/MixedContentChecker.cpp

Issue 1299493003: Attach mixed content status to resource requests when sent to devtools (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add contextTypeForInspector() unit test Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/MixedContentChecker.h ('k') | Source/core/loader/MixedContentCheckerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/loader/MixedContentChecker.h ('k') | Source/core/loader/MixedContentCheckerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698