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

Side by Side Diff: third_party/WebKit/Source/core/dom/SecurityContext.cpp

Issue 1723753002: Make Document::isSecureContext() work for OOPIFs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout test tweaks, remove unnecessarily #include Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // a place to inherit the origin from). 67 // a place to inherit the origin from).
68 if (!haveInitializedSecurityOrigin()) 68 if (!haveInitializedSecurityOrigin())
69 return true; 69 return true;
70 70
71 RefPtr<SecurityOrigin> other = SecurityOrigin::create(url); 71 RefPtr<SecurityOrigin> other = SecurityOrigin::create(url);
72 return securityOrigin()->canAccess(other.get()); 72 return securityOrigin()->canAccess(other.get());
73 } 73 }
74 74
75 void SecurityContext::enforceSandboxFlags(SandboxFlags mask) 75 void SecurityContext::enforceSandboxFlags(SandboxFlags mask)
76 { 76 {
77 // The security origin must be set already in order to determine a sandboxed origin's potential trustworthiness.
78 ASSERT(securityOrigin());
77 m_sandboxFlags |= mask; 79 m_sandboxFlags |= mask;
78 80
79 if (isSandboxed(SandboxOrigin) && securityOrigin() && !securityOrigin()->isU nique()) { 81 if (isSandboxed(SandboxOrigin) && !securityOrigin()->isUnique()) {
80 setSecurityOrigin(SecurityOrigin::createUnique()); 82 // Before overwriting the original origin, compute secure
83 // context properties from it. These properties are used to do
84 // secure context checks involving unique origins in remote
85 // frames.
86 setSecurityOrigin(SecurityOrigin::createUnique(securityOrigin()->isPoten tiallyTrustworthy(), securityOrigin()->isPotentiallyTrustworthy() && securityOri gin()->bypassSecureContextCheck()));
81 didUpdateSecurityOrigin(); 87 didUpdateSecurityOrigin();
82 } 88 }
83 } 89 }
84 90
85 } // namespace blink 91 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698