Index: third_party/WebKit/Source/core/dom/SecurityContext.cpp |
diff --git a/third_party/WebKit/Source/core/dom/SecurityContext.cpp b/third_party/WebKit/Source/core/dom/SecurityContext.cpp |
index a37ff6b8230baa1b56ff5bf886d6a06243d97da4..89fa373dbc757319cc71c29998990d8c39b288ac 100644 |
--- a/third_party/WebKit/Source/core/dom/SecurityContext.cpp |
+++ b/third_party/WebKit/Source/core/dom/SecurityContext.cpp |
@@ -27,6 +27,7 @@ |
#include "core/dom/SecurityContext.h" |
#include "core/frame/csp/ContentSecurityPolicy.h" |
+#include "platform/weborigin/SchemeRegistry.h" |
#include "platform/weborigin/SecurityOrigin.h" |
namespace blink { |
@@ -74,10 +75,16 @@ bool SecurityContext::isSecureTransitionTo(const KURL& url) const |
void SecurityContext::enforceSandboxFlags(SandboxFlags mask) |
{ |
+ // The security origin must be set already in order to determine a sandboxed origin's potential trustworthiness. |
Mike West
2016/02/25 11:58:11
We apparently don't have any unit tests for this m
estark
2016/03/01 02:59:26
Done. I'm happy to add isSecureContext() tests but
|
+ ASSERT(securityOrigin()); |
m_sandboxFlags |= mask; |
- if (isSandboxed(SandboxOrigin) && securityOrigin() && !securityOrigin()->isUnique()) { |
- setSecurityOrigin(SecurityOrigin::createUnique()); |
+ if (isSandboxed(SandboxOrigin) && !securityOrigin()->isUnique()) { |
+ // Before overwriting the original origin, compute secure |
+ // context properties from it. These properties are used to do |
+ // secure context checks involving unique origins in remote |
+ // frames. |
+ setSecurityOrigin(SecurityOrigin::createUnique(securityOrigin()->isPotentiallyTrustworthy(), securityOrigin()->isPotentiallyTrustworthy() && SchemeRegistry::schemeShouldBypassSecureContextCheck(securityOrigin()->protocol()))); |
alexmos
2016/02/26 19:21:57
Would it make sense for the scheme check to just u
estark
2016/03/01 02:59:26
Done.
|
didUpdateSecurityOrigin(); |
} |
} |