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

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: SupportingFetchAPI 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
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())
dcheng 2015/08/25 20:07:32 Out of curiosity, any particular reason to special
not at google - send to devlin 2015/08/25 20:09:03 No idea, I just copied service worker code, but I
pdr. 2015/08/25 21:25:10 Lets just assert !scheme.isEmpty().
not at google - send to devlin 2015/08/25 22:04:45 SGTM, if you're confident, but it would be odd for
tyoshino (SeeGerritForStatus) 2015/08/26 07:24:48 +1. Change to other methods could be done as a sep
not at google - send to devlin 2015/08/26 16:30:32 Acknowledged.
+ return false;
+ MutexLocker locker(mutex());
+ return fetchAPISchemes().contains(scheme);
+}
+
void SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme, PolicyAreas policyAreas)
{
MutexLocker locker(mutex());

Powered by Google App Engine
This is Rietveld 408576698