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

Unified Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 1099453005: Switch web API/permission code to use IsOriginSecure() instead of SchemeIsSecure(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove an ad-hoc definition of IsSchemeSecure() from a header file. Created 5 years, 8 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 | « content/browser/appcache/appcache_update_job.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_dispatcher_host.cc
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index 3340f871853af14d17d1567f3b6680e016326c36..c35b508b19d8c4722b193f684fbf0ce02dfc7d19 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -8,6 +8,7 @@
#include "base/profiler/scoped_tracker.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/trace_event.h"
+#include "chrome/common/origin_util.h"
#include "content/browser/message_port_message_filter.h"
#include "content/browser/message_port_service.h"
#include "content/browser/service_worker/embedded_worker_registry.h"
@@ -50,14 +51,6 @@ bool AllOriginsMatch(const GURL& url_a, const GURL& url_b, const GURL& url_c) {
url_a.GetOrigin() == url_c.GetOrigin();
}
-// TODO(dominicc): When crbug.com/362214 is fixed use that to be
-// consistent with Blink's
-// SecurityOrigin::canAccessFeatureRequiringSecureOrigin.
-bool OriginCanAccessServiceWorkers(const GURL& url) {
- return url.SchemeIsHTTPOrHTTPS() &&
- (url.SchemeIsSecure() || net::IsLocalhost(url.host()));
-}
-
bool CanRegisterServiceWorker(const GURL& document_url,
const GURL& pattern,
const GURL& script_url) {
@@ -65,9 +58,8 @@ bool CanRegisterServiceWorker(const GURL& document_url,
DCHECK(pattern.is_valid());
DCHECK(script_url.is_valid());
return AllOriginsMatch(document_url, pattern, script_url) &&
- OriginCanAccessServiceWorkers(document_url) &&
- OriginCanAccessServiceWorkers(pattern) &&
- OriginCanAccessServiceWorkers(script_url);
+ IsOriginSecure(document_url) && IsOriginSecure(pattern) &&
+ IsOriginSecure(script_url);
nhiroki 2015/04/23 01:29:58 IsOriginSecure() is not sufficient here because Se
lgarron 2015/04/23 02:06:04 Drive-by comments are welcome! You're right, that
}
bool CanUnregisterServiceWorker(const GURL& document_url,
@@ -75,8 +67,7 @@ bool CanUnregisterServiceWorker(const GURL& document_url,
DCHECK(document_url.is_valid());
DCHECK(pattern.is_valid());
return document_url.GetOrigin() == pattern.GetOrigin() &&
- OriginCanAccessServiceWorkers(document_url) &&
- OriginCanAccessServiceWorkers(pattern);
+ IsOriginSecure(document_url) && IsOriginSecure(pattern);
}
bool CanGetRegistration(const GURL& document_url,
@@ -84,8 +75,7 @@ bool CanGetRegistration(const GURL& document_url,
DCHECK(document_url.is_valid());
DCHECK(given_document_url.is_valid());
return document_url.GetOrigin() == given_document_url.GetOrigin() &&
- OriginCanAccessServiceWorkers(document_url) &&
- OriginCanAccessServiceWorkers(given_document_url);
+ IsOriginSecure(document_url) && IsOriginSecure(given_document_url);
}
} // namespace
« no previous file with comments | « content/browser/appcache/appcache_update_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698