Index: content/browser/shared_worker/shared_worker_instance.cc |
diff --git a/content/browser/shared_worker/shared_worker_instance.cc b/content/browser/shared_worker/shared_worker_instance.cc |
index a55dd918152761871ea6aa06de5f4e7c0ce82ed7..3d7bba5ebda8ce259185ee12bdbf391ed2d2cd18 100644 |
--- a/content/browser/shared_worker/shared_worker_instance.cc |
+++ b/content/browser/shared_worker/shared_worker_instance.cc |
@@ -46,7 +46,7 @@ void SharedWorkerInstance::SetMessagePortID( |
bool SharedWorkerInstance::Matches(const GURL& match_url, |
const base::string16& match_name, |
const WorkerStoragePartition& partition, |
- ResourceContext* resource_context) const { |
+ ResourceContext* resource_context) const { |
// Only match open shared workers. |
if (closed_) |
return false; |
@@ -61,13 +61,21 @@ bool SharedWorkerInstance::Matches(const GURL& match_url, |
if (!partition_.Equals(partition)) |
return false; |
- if (url_.GetOrigin() != match_url.GetOrigin()) |
+ return UrlNameMatches(url_, name_, match_url, match_name); |
+} |
+ |
+// static |
+bool SharedWorkerInstance::UrlNameMatches(const GURL& url1, |
+ const base::string16& name1, |
+ const GURL& url2, |
+ const base::string16& name2) { |
+ if (url1.GetOrigin() != url2.GetOrigin()) |
return false; |
- if (name_.empty() && match_name.empty()) |
- return url_ == match_url; |
+ if (name1.empty() && name2.empty()) |
+ return url1 == url2; |
- return name_ == match_name; |
+ return name1 == name2; |
} |
void SharedWorkerInstance::AddFilter(SharedWorkerMessageFilter* filter, |