OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/shared_worker/shared_worker_instance.h" | 5 #include "content/browser/shared_worker/shared_worker_instance.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 return false; | 50 return false; |
51 | 51 |
52 // We must be in the same storage partition otherwise sharing will violate | 52 // We must be in the same storage partition otherwise sharing will violate |
53 // isolation. | 53 // isolation. |
54 if (!partition_id_.Equals(partition_id)) | 54 if (!partition_id_.Equals(partition_id)) |
55 return false; | 55 return false; |
56 | 56 |
57 if (url_.GetOrigin() != match_url.GetOrigin()) | 57 if (url_.GetOrigin() != match_url.GetOrigin()) |
58 return false; | 58 return false; |
59 | 59 |
60 if (name_.empty() && match_name.empty()) | 60 if (name_ != match_name || url_ != match_url) |
61 return url_ == match_url; | 61 return false; |
62 | 62 return true; |
63 return name_ == match_name; | |
64 } | 63 } |
65 | 64 |
66 bool SharedWorkerInstance::Matches(const SharedWorkerInstance& other) const { | 65 bool SharedWorkerInstance::Matches(const SharedWorkerInstance& other) const { |
67 return Matches(other.url(), | 66 return Matches(other.url(), |
68 other.name(), | 67 other.name(), |
69 other.partition_id(), | 68 other.partition_id(), |
70 other.resource_context()); | 69 other.resource_context()); |
71 } | 70 } |
72 | 71 |
73 } // namespace content | 72 } // namespace content |
OLD | NEW |