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

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

Issue 91353002: CSP 1.1: Implement the 'frame-ancestors' directive. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh. Created 6 years, 11 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/frame/ContentSecurityPolicy.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index 2c3844ca7adc7ec047ffe5092226ff41d1bb7f04..ca89ef214917e8b71d2793af7ba5811576abf485 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -361,6 +361,25 @@ void FrameLoader::didBeginDocument(bool dispatch)
m_frame->document()->initContentSecurityPolicy(m_documentLoader ? ContentSecurityPolicyResponseHeaders(m_documentLoader->response()) : ContentSecurityPolicyResponseHeaders());
+ if (!m_frame->document()->contentSecurityPolicy()->allowAncestors(m_frame)) {
+ // load event and stopAllLoaders can detach the Frame, so protect it.
Nate Chapin 2014/01/21 18:24:22 The contents of this if() should probably be a hel
Mike West 2014/01/22 10:08:46 Done.
+ RefPtr<Frame> protect(m_frame);
+
+ // Move the page to a unique origin.
+ m_frame->document()->enforceSandboxFlags(SandboxOrigin);
+
+ // Fire a load event, as timing attacks would otherwise reveal that the
+ // frame was blocked. This way, it looks like every other cross-origin
+ // page.
+ if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement())
+ ownerElement->dispatchEvent(Event::create(EventTypeNames::load));
+
+ stopAllLoaders();
Nate Chapin 2014/01/21 18:24:22 If a navigation was triggered during the load even
Mike West 2014/01/22 10:08:46 Hrm. Probably not. I'll reverse the order.
+ clear();
Nate Chapin 2014/01/21 18:24:22 Do you really need clear() here? It was just calle
Mike West 2014/01/22 10:08:46 Done.
+ return;
+ }
+
+
Settings* settings = m_frame->document()->settings();
if (settings) {
m_frame->document()->fetcher()->setImagesEnabled(settings->imagesEnabled());
« no previous file with comments | « Source/core/frame/ContentSecurityPolicy.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698