Index: content/browser/service_worker/service_worker_utils.cc |
diff --git a/content/browser/service_worker/service_worker_utils.cc b/content/browser/service_worker/service_worker_utils.cc |
index e05c546d73d1ba9f28d991d9dbca3068282054f6..47c80ce4433d147598e93ddb3256450e9b084783 100644 |
--- a/content/browser/service_worker/service_worker_utils.cc |
+++ b/content/browser/service_worker/service_worker_utils.cc |
@@ -5,7 +5,6 @@ |
#include "content/browser/service_worker/service_worker_utils.h" |
#include "base/command_line.h" |
-#include "base/strings/string_util.h" |
#include "content/public/common/content_switches.h" |
namespace content { |
@@ -19,15 +18,12 @@ bool ServiceWorkerUtils::IsFeatureEnabled() { |
// static |
bool ServiceWorkerUtils::ScopeMatches(const GURL& scope, const GURL& url) { |
- // This is a really basic, naive |
- // TODO(alecflett): Formalize what scope matches mean. |
- // Temporarily borrowed directly from appcache::Namespace::IsMatch(). |
- // We have to escape '?' characters since MatchPattern also treats those |
- // as wildcards which we don't want here, we only do '*'s. |
- std::string scope_spec(scope.spec()); |
- if (scope.has_query()) |
- ReplaceSubstringsAfterOffset(&scope_spec, 0, "?", "\\?"); |
- return MatchPattern(url.spec(), scope_spec); |
+ const std::string& scope_spec(scope.spec()); |
+ size_t len = scope_spec.size(); |
+ if (len > 0 && scope_spec[len - 1] == '*') { |
kinuko
2014/05/14 23:44:23
Does this code assume scope is relative or * is in
jsbell
2014/05/16 07:05:45
It assumes scope GURL is absolute (it's made so in
|
+ return scope_spec.compare(0, len - 1, url.spec(), 0, len - 1) == 0; |
+ } |
+ return scope_spec == url.spec(); |
} |
} // namespace content |