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

Unified Diff: content/common/service_worker/service_worker_utils.cc

Issue 2196633002: [ServiceWorker] Don't check the origin equality when disable-web-security flag is set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated nhiroki and shimazu's comment Created 4 years, 5 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: content/common/service_worker/service_worker_utils.cc
diff --git a/content/common/service_worker/service_worker_utils.cc b/content/common/service_worker/service_worker_utils.cc
index 3a4971fc4ec7cd75a1cd022eba2e40853a891811..fbc1de1e0eefa1dc51d43a1ff62fc744da2b3a8d 100644
--- a/content/common/service_worker/service_worker_utils.cc
+++ b/content/common/service_worker/service_worker_utils.cc
@@ -6,8 +6,10 @@
#include <string>
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
+#include "content/public/common/content_switches.h"
nhiroki 2016/08/01 08:21:25 These inclusions are not necessary.
horo 2016/08/01 10:48:47 Done.
#include "content/public/common/origin_util.h"
namespace content {
@@ -31,11 +33,6 @@ bool PathContainsDisallowedCharacter(const GURL& url) {
return false;
}
-bool AllOriginsMatch(const GURL& url_a, const GURL& url_b, const GURL& url_c) {
- return url_a.GetOrigin() == url_b.GetOrigin() &&
- url_a.GetOrigin() == url_c.GetOrigin();
-}
-
} // namespace
// static
@@ -116,7 +113,8 @@ bool ServiceWorkerUtils::CanRegisterServiceWorker(const GURL& context_url,
DCHECK(context_url.is_valid());
DCHECK(pattern.is_valid());
DCHECK(script_url.is_valid());
- return AllOriginsMatch(context_url, pattern, script_url) &&
+ return ServiceWorkerUtils::PassOriginEqualitySecurityCheck<GURL>(
+ context_url, pattern, script_url) &&
OriginCanAccessServiceWorkers(context_url) &&
OriginCanAccessServiceWorkers(pattern) &&
OriginCanAccessServiceWorkers(script_url);

Powered by Google App Engine
This is Rietveld 408576698