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

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

Issue 348853009: Refactor mixed content checks against the top frame into MixedContentChecker. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WSS. Created 6 years, 6 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
Index: Source/core/loader/MixedContentChecker.cpp
diff --git a/Source/core/loader/MixedContentChecker.cpp b/Source/core/loader/MixedContentChecker.cpp
index ea95015d1ed244d8e5e552adb375226b0c076c28..d4cb280ed2deb4d3537dd4d29c14de28406563b1 100644
--- a/Source/core/loader/MixedContentChecker.cpp
+++ b/Source/core/loader/MixedContentChecker.cpp
@@ -62,6 +62,18 @@ bool MixedContentChecker::isMixedContent(SecurityOrigin* securityOrigin, const K
bool MixedContentChecker::canDisplayInsecureContentInternal(SecurityOrigin* securityOrigin, const KURL& url, const MixedContentType type) const
{
+ // Check the top frame if it differs from MixedContentChecker's m_frame.
+ if (!m_frame->tree().top()->isLocalFrame()) {
+ // FIXME: We need a way to access the top-level frame's MixedContentChecker when that frame
+ // is in a different process from the current frame. Until that is done, we always allow
+ // loads in remote frames.
+ return false;
+ }
+ Frame* top = m_frame->tree().top();
+ if (top != m_frame && !toLocalFrame(top)->loader().mixedContentChecker()->canDisplayInsecureContent(toLocalFrame(top)->document()->securityOrigin(), url))
+ return false;
+
+ // Then check the current frame:
if (!isMixedContent(securityOrigin, url))
return true;
@@ -77,6 +89,18 @@ bool MixedContentChecker::canDisplayInsecureContentInternal(SecurityOrigin* secu
bool MixedContentChecker::canRunInsecureContentInternal(SecurityOrigin* securityOrigin, const KURL& url, const MixedContentType type) const
{
+ // Check the top frame if it differs from MixedContentChecker's m_frame.
+ if (!m_frame->tree().top()->isLocalFrame()) {
+ // FIXME: We need a way to access the top-level frame's MixedContentChecker when that frame
+ // is in a different process from the current frame. Until that is done, we always allow
+ // loads in remote frames.
+ return false;
+ }
+ Frame* top = m_frame->tree().top();
+ if (top != m_frame && !toLocalFrame(top)->loader().mixedContentChecker()->canRunInsecureContent(toLocalFrame(top)->document()->securityOrigin(), url))
+ return false;
+
+ // Then check the current frame:
if (!isMixedContent(securityOrigin, url))
return true;

Powered by Google App Engine
This is Rietveld 408576698