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..b2b2f5867e3b59799b76671359413ff766a357c6 100644 |
--- a/third_party/WebKit/Source/core/dom/DocumentInit.cpp |
+++ b/third_party/WebKit/Source/core/dom/DocumentInit.cpp |
@@ -104,7 +104,17 @@ 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 |
+ if (loader->documentLoader() && loader->documentLoader()->wasBlockedAfterXFrameOptionsOrCSP()) |
+ flags |= SandboxOrigin; |
+ |
+ return flags; |
} |
bool DocumentInit::shouldEnforceStrictMixedContentChecking() const |