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

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: Rebase 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());
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698