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()); |