Commit d8274d90 authored by csharrison's avatar csharrison Committed by Commit bot

Clean registering mixed content restricting schemes

This API is unused, so there is no need for a thread safe map, or even
a scheme map at all.

BUG=348655

Review-Url: https://codereview.chromium.org/2475673003
Cr-Commit-Position: refs/heads/master@{#430280}
parent 4711d631
...@@ -60,14 +60,6 @@ static URLSchemesSet& displayIsolatedURLSchemes() { ...@@ -60,14 +60,6 @@ static URLSchemesSet& displayIsolatedURLSchemes() {
return displayIsolatedSchemes; return displayIsolatedSchemes;
} }
static URLSchemesSet& mixedContentRestrictingSchemes() {
DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, mixedContentRestrictingSchemes,
({
"https",
}));
return mixedContentRestrictingSchemes;
}
static URLSchemesSet& secureSchemes() { static URLSchemesSet& secureSchemes() {
DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, secureSchemes, DEFINE_STATIC_LOCAL_WITH_LOCK(URLSchemesSet, secureSchemes,
({ ({
...@@ -223,20 +215,10 @@ bool SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated( ...@@ -223,20 +215,10 @@ bool SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(
return displayIsolatedURLSchemes().contains(scheme); return displayIsolatedURLSchemes().contains(scheme);
} }
void SchemeRegistry::registerURLSchemeAsRestrictingMixedContent(
const String& scheme) {
DCHECK_EQ(scheme, scheme.lower());
MutexLocker locker(mutex());
mixedContentRestrictingSchemes().add(scheme);
}
bool SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent( bool SchemeRegistry::shouldTreatURLSchemeAsRestrictingMixedContent(
const String& scheme) { const String& scheme) {
DCHECK_EQ(scheme, scheme.lower()); DCHECK_EQ(scheme, scheme.lower());
if (scheme.isEmpty()) return scheme == "https";
return false;
MutexLocker locker(mutex());
return mixedContentRestrictingSchemes().contains(scheme);
} }
void SchemeRegistry::registerURLSchemeAsSecure(const String& scheme) { void SchemeRegistry::registerURLSchemeAsSecure(const String& scheme) {
......
...@@ -50,7 +50,6 @@ class PLATFORM_EXPORT SchemeRegistry { ...@@ -50,7 +50,6 @@ class PLATFORM_EXPORT SchemeRegistry {
static void registerURLSchemeAsLocal(const String&); static void registerURLSchemeAsLocal(const String&);
static bool shouldTreatURLSchemeAsLocal(const String&); static bool shouldTreatURLSchemeAsLocal(const String&);
static void registerURLSchemeAsRestrictingMixedContent(const String&);
static bool shouldTreatURLSchemeAsRestrictingMixedContent(const String&); static bool shouldTreatURLSchemeAsRestrictingMixedContent(const String&);
// Subresources transported by secure schemes do not trigger mixed content // Subresources transported by secure schemes do not trigger mixed content
......
...@@ -53,19 +53,10 @@ void WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( ...@@ -53,19 +53,10 @@ void WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(
SchemeRegistry::registerURLSchemeAsDisplayIsolated(scheme); SchemeRegistry::registerURLSchemeAsDisplayIsolated(scheme);
} }
void WebSecurityPolicy::registerURLSchemeAsRestrictingMixedContent(
const WebString& scheme) {
SchemeRegistry::registerURLSchemeAsRestrictingMixedContent(scheme);
}
void WebSecurityPolicy::registerURLSchemeAsSecure(const WebString& scheme) { void WebSecurityPolicy::registerURLSchemeAsSecure(const WebString& scheme) {
SchemeRegistry::registerURLSchemeAsSecure(scheme); SchemeRegistry::registerURLSchemeAsSecure(scheme);
} }
bool WebSecurityPolicy::shouldTreatURLSchemeAsSecure(const WebString& scheme) {
return SchemeRegistry::shouldTreatURLSchemeAsSecure(scheme);
}
void WebSecurityPolicy::registerURLSchemeAsCORSEnabled( void WebSecurityPolicy::registerURLSchemeAsCORSEnabled(
const WebString& scheme) { const WebString& scheme) {
SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme); SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme);
......
...@@ -58,19 +58,11 @@ class WebSecurityPolicy { ...@@ -58,19 +58,11 @@ class WebSecurityPolicy {
// hyperlinks to URLs with the scheme. // hyperlinks to URLs with the scheme.
BLINK_EXPORT static void registerURLSchemeAsDisplayIsolated(const WebString&); BLINK_EXPORT static void registerURLSchemeAsDisplayIsolated(const WebString&);
// Registers a URL scheme to generate mixed content warnings when resources
// whose schemes are not registered as "secure" are embedded.
BLINK_EXPORT static void registerURLSchemeAsRestrictingMixedContent(
const WebString&);
// Subresources transported by secure schemes do not trigger mixed content // Subresources transported by secure schemes do not trigger mixed content
// warnings. For example, https and data are secure schemes because they // warnings. For example, https and data are secure schemes because they
// cannot be corrupted by active network attackers. // cannot be corrupted by active network attackers.
BLINK_EXPORT static void registerURLSchemeAsSecure(const WebString&); BLINK_EXPORT static void registerURLSchemeAsSecure(const WebString&);
// Returns true if the scheme has been registered as a secure scheme.
BLINK_EXPORT static bool shouldTreatURLSchemeAsSecure(const WebString&);
// Registers a non-HTTP URL scheme which can be sent CORS requests. // Registers a non-HTTP URL scheme which can be sent CORS requests.
BLINK_EXPORT static void registerURLSchemeAsCORSEnabled(const WebString&); BLINK_EXPORT static void registerURLSchemeAsCORSEnabled(const WebString&);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment