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

Unified Diff: third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp

Issue 1383483007: Add scheme exceptions for isSecureContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Update check for sandbox Created 5 years, 2 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/platform/weborigin/SecurityPolicy.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
index a0bb8b1c9491f6078da4eb4c1411797fef262c42..e8de40e1e0aa33fc79531b81d28f66ffb94a1796 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityPolicy.cpp
@@ -46,6 +46,7 @@ namespace blink {
using OriginAccessWhiteList = Vector<OriginAccessEntry>;
using OriginAccessMap = HashMap<String, OwnPtr<OriginAccessWhiteList>>;
using OriginSet = HashSet<String>;
+using SchemeSet = HashSet<String>;
Mike West 2015/10/06 07:22:34 I'd prefer to see this done via `Source/platform/w
jww 2015/10/06 21:53:56 Done.
static OriginAccessMap& originAccessMap()
{
@@ -59,10 +60,17 @@ static OriginSet& trustworthyOriginSet()
return trustworthyOriginSet;
}
+static SchemeSet& schemesBypassingSecureContextCheckSet()
+{
+ DEFINE_STATIC_LOCAL(SchemeSet, bypassSecureContextCheckSet, ());
+ return bypassSecureContextCheckSet;
+}
+
void SecurityPolicy::init()
{
originAccessMap();
trustworthyOriginSet();
+ schemesBypassingSecureContextCheckSet();
}
bool SecurityPolicy::shouldHideReferrer(const KURL& url, const String& referrer)
@@ -146,6 +154,20 @@ bool SecurityPolicy::isOriginWhiteListedTrustworthy(const SecurityOrigin& origin
return trustworthyOriginSet().contains(origin.toRawString());
}
+void SecurityPolicy::addSchemeToBypassSecureContextWhitelist(const String& scheme)
+{
+ // Must be called before we start other threads.
+ ASSERT(WTF::isBeforeThreadCreated());
+ schemesBypassingSecureContextCheckSet().add(scheme);
+}
+
+bool SecurityPolicy::shouldOriginBypassSecureContextCheck(const SecurityOrigin& origin)
+{
+ if (origin.isUnique())
+ return false;
+ return schemesBypassingSecureContextCheckSet().contains(origin.protocol());
+}
+
bool SecurityPolicy::isAccessWhiteListed(const SecurityOrigin* activeOrigin, const SecurityOrigin* targetOrigin)
{
if (OriginAccessWhiteList* list = originAccessMap().get(activeOrigin->toString())) {

Powered by Google App Engine
This is Rietveld 408576698