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

Unified Diff: third_party/WebKit/Source/core/dom/DocumentInit.cpp

Issue 1742923002: Commit empty document instead of canceling the load for blocked CSP/XFO responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update expectations for XFO layout tests Created 4 years, 10 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: third_party/WebKit/Source/core/dom/DocumentInit.cpp
diff --git a/third_party/WebKit/Source/core/dom/DocumentInit.cpp b/third_party/WebKit/Source/core/dom/DocumentInit.cpp
index c75e302fb53fa52ee48faf6f25fb67338b1af2fe..fe487a8f66f5a2e5adb8b4aaab04eb8fa991896b 100644
--- a/third_party/WebKit/Source/core/dom/DocumentInit.cpp
+++ b/third_party/WebKit/Source/core/dom/DocumentInit.cpp
@@ -104,7 +104,18 @@ LocalFrame* DocumentInit::frameForSecurityContext() const
SandboxFlags DocumentInit::getSandboxFlags() const
{
ASSERT(frameForSecurityContext());
- return frameForSecurityContext()->loader().effectiveSandboxFlags();
+ FrameLoader* loader = &frameForSecurityContext()->loader();
+ SandboxFlags flags = loader->effectiveSandboxFlags();
+
+ // If the load was blocked by X-Frame-Options or CSP, force the Document's
+ // origin to be unique, so that the blocked document appears to be a normal
+ // cross-origin document's load per CSP spec:
+ // https://www.w3.org/TR/CSP2/#directive-frame-ancestors
+ DocumentLoader* documentLoader = loader->provisionalDocumentLoader() ? loader->provisionalDocumentLoader() : loader->documentLoader();
Nate Chapin 2016/03/01 20:26:11 Is it really possible for this to be either docume
alexmos 2016/03/02 01:30:55 Good point. Looking closer I think this should ju
+ if (documentLoader && documentLoader->wasBlockedAfterXFrameOptionsOrCSP())
+ flags |= SandboxOrigin;
+
+ return flags;
}
bool DocumentInit::shouldEnforceStrictMixedContentChecking() const

Powered by Google App Engine
This is Rietveld 408576698