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

Unified Diff: Source/platform/weborigin/SchemeRegistry.cpp

Issue 1191793003: [Service Worker Registration] removed protocolIsInHTTPFamily and replaced with SchemeRegistry check (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Comments Created 5 years, 6 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
« no previous file with comments | « Source/platform/weborigin/SchemeRegistry.h ('k') | Source/web/WebSecurityPolicy.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/weborigin/SchemeRegistry.cpp
diff --git a/Source/platform/weborigin/SchemeRegistry.cpp b/Source/platform/weborigin/SchemeRegistry.cpp
index 84363e578936ba3948e1f84d720e8c8dbb11bb8a..822ae67a5fe8b98591ec9a7d7fae47c79435fcb1 100644
--- a/Source/platform/weborigin/SchemeRegistry.cpp
+++ b/Source/platform/weborigin/SchemeRegistry.cpp
@@ -160,6 +160,22 @@ static URLSchemesSet& CORSEnabledSchemes()
return CORSEnabledSchemes;
}
+static URLSchemesSet& serviceWorkerSchemes()
+{
+ assertLockHeld();
+ DEFINE_STATIC_LOCAL_NOASSERT(URLSchemesSet, serviceWorkerSchemes, ());
+
+ if (serviceWorkerSchemes.isEmpty()) {
+ // HTTP is required because http://localhost is considered secure.
+ // Additional checks are performed to ensure that other http pages
+ // are filtered out.
+ serviceWorkerSchemes.add("http");
+ serviceWorkerSchemes.add("https");
+ }
+
+ return serviceWorkerSchemes;
+}
+
static URLSchemesMap<SchemeRegistry::PolicyAreas>& ContentSecurityPolicyBypassingSchemes()
{
assertLockHeld();
@@ -323,6 +339,20 @@ bool SchemeRegistry::shouldTreatURLSchemeAsLegacy(const String& scheme)
return equalIgnoringCase("ftp", scheme) || equalIgnoringCase("gopher", scheme);
}
+void SchemeRegistry::registerURLSchemeAsAllowingServiceWorkers(const String& scheme)
+{
+ MutexLocker locker(mutex());
+ serviceWorkerSchemes().add(scheme);
+}
+
+bool SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers(const String& scheme)
+{
+ if (scheme.isEmpty())
+ return false;
+ MutexLocker locker(mutex());
+ return serviceWorkerSchemes().contains(scheme);
+}
+
void SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme, PolicyAreas policyAreas)
{
MutexLocker locker(mutex());
« no previous file with comments | « Source/platform/weborigin/SchemeRegistry.h ('k') | Source/web/WebSecurityPolicy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698