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

Unified Diff: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp

Issue 1495013002: Check for equality of the URL's origin in replaceState/pushState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow --disable-web-security again, add more tests Created 5 years 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: third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
index a441e80df2c64cdf136c1d2e41f7130994e55d5a..d67632a171e35f0304e4774704134b64f0a5ca82 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp
@@ -366,6 +366,28 @@ bool SecurityOrigin::canDisplay(const KURL& url) const
return true;
}
+bool SecurityOrigin::areSamePageUrls(const KURL& a, const KURL& b) const
+{
+ if (m_universalAccess)
+ return true;
+
+ if (isUnique())
+ return false;
+
+ if (!equalIgnoringPathQueryAndFragment(a, b))
brettw 2015/12/08 05:41:32 Personally, I would prefer manually checking schem
robwu 2015/12/08 08:45:17 Checking for scheme/host/port equality is not suff
Mike West 2015/12/08 13:45:19 This is defined somewhat strangely in HTML as "If
robwu 2015/12/08 14:10:39 I presume that you're fine with exposing the value
Mike West 2015/12/08 14:18:41 I would dearly love to murder that property entire
+ return false;
+
+ RefPtr<SecurityOrigin> originA = SecurityOrigin::create(a);
+ if (originA->isUnique() || !isSameSchemeHostPort(originA.get()))
+ return false;
+
+ RefPtr<SecurityOrigin> originB = SecurityOrigin::create(b);
+ if (originB->isUnique() || !isSameSchemeHostPort(originB.get()))
+ return false;
+
+ return true;
+}
+
bool SecurityOrigin::isPotentiallyTrustworthy(String& errorMessage) const
{
ASSERT(m_protocol != "data");

Powered by Google App Engine
This is Rietveld 408576698