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

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

Issue 1313733006: Allowing registering arbitrary schemes as supporting the fetch API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: http-like #2 Created 5 years, 4 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 822ae67a5fe8b98591ec9a7d7fae47c79435fcb1..099dbbb17a03895397bf9870779e686e6c41353c 100644
--- a/Source/platform/weborigin/SchemeRegistry.cpp
+++ b/Source/platform/weborigin/SchemeRegistry.cpp
@@ -176,6 +176,19 @@ static URLSchemesSet& serviceWorkerSchemes()
return serviceWorkerSchemes;
}
+static URLSchemesSet& fetchAPISchemes()
+{
+ assertLockHeld();
+ DEFINE_STATIC_LOCAL_NOASSERT(URLSchemesSet, fetchAPISchemes, ());
+
+ if (fetchAPISchemes.isEmpty()) {
+ fetchAPISchemes.add("http");
+ fetchAPISchemes.add("https");
+ }
+
+ return fetchAPISchemes;
+}
+
static URLSchemesMap<SchemeRegistry::PolicyAreas>& ContentSecurityPolicyBypassingSchemes()
{
assertLockHeld();
@@ -353,6 +366,20 @@ bool SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers(const String&
return serviceWorkerSchemes().contains(scheme);
}
+void SchemeRegistry::registerURLSchemeAsSupportingFetchAPI(const String& scheme)
+{
+ MutexLocker locker(mutex());
+ fetchAPISchemes().add(scheme);
+}
+
+bool SchemeRegistry::shouldTreatURLSchemeAsSupportingFetchAPI(const String& scheme)
+{
+ if (scheme.isEmpty())
+ return false;
+ MutexLocker locker(mutex());
+ return fetchAPISchemes().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