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

Unified Diff: content/browser/isolated_origin_util.cc

Issue 2891443002: Keep subdomains of an isolated origin in the isolated origin's SiteInstance. (Closed)
Patch Set: More cleanup Created 3 years, 6 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/browser/isolated_origin_util.cc
diff --git a/content/browser/isolated_origin_util.cc b/content/browser/isolated_origin_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..811ded12b16e488da3d24594b393fc59b9e28b49
--- /dev/null
+++ b/content/browser/isolated_origin_util.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/isolated_origin_util.h"
+
+#include "base/strings/string_util.h"
+#include "url/gurl.h"
+
+namespace content {
+
+// static
+bool IsolatedOriginUtil::DoesOriginMatchIsolatedOrigin(
+ const url::Origin& origin,
+ const url::Origin& isolated_origin) {
+ if (origin.scheme() != isolated_origin.scheme())
+ return false;
+
+ if (origin.port() != isolated_origin.port())
+ return false;
+
+ // Subdomains of an isolated origin are considered to be in the same isolated
+ // origin.
+ return origin.GetURL().DomainIs(isolated_origin.host());
Charlie Reis 2017/06/28 01:02:18 Huh, I wouldn't have expected this to work given t
alexmos 2017/06/28 18:29:51 Yeah, it behaves like IsSubdomainOf; this is more
Charlie Reis 2017/06/28 20:56:57 Yes, there may be some ways to make this clearer.
ncarter (slow) 2017/06/28 21:07:49 fwiw I did the same double take too. url::Origin
alexmos 2017/06/29 21:54:01 Done. Thanks, I didn't notice it was also exposed
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698