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

Unified Diff: third_party/WebKit/Source/core/frame/History.cpp

Issue 2060093002: Allow 'history.pushState' to modify query string for unique and file origins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow 'history.pushState' to modify query string for unique and file origins. Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-whitelisted-at-unique-origin-denied.php ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/History.cpp
diff --git a/third_party/WebKit/Source/core/frame/History.cpp b/third_party/WebKit/Source/core/frame/History.cpp
index 393394fd90761c0421b21ac3a049088aa8b50c83..dc7802484a843656537fca413322ffe118fa1904 100644
--- a/third_party/WebKit/Source/core/frame/History.cpp
+++ b/third_party/WebKit/Source/core/frame/History.cpp
@@ -59,6 +59,23 @@ bool equalIgnoringPathQueryAndFragment(const KURL& a, const KURL& b)
return true;
}
+bool equalIgnoringQueryAndFragment(const KURL& a, const KURL& b)
+{
+ int aLength = a.pathEnd();
+ int bLength = b.pathEnd();
+
+ if (aLength != bLength)
+ return false;
+
+ const String& aString = a.getString();
+ const String& bString = b.getString();
+ for (int i = 0; i < aLength; ++i) {
+ if (aString[i] != bString[i])
+ return false;
+ }
+ return true;
+}
+
} // namespace
History::History(LocalFrame* frame)
@@ -196,7 +213,7 @@ bool History::canChangeToUrl(const KURL& url, SecurityOrigin* documentOrigin, co
// 'pushState'/'replaceState' to modify the URL fragment: see
// https://crbug.com/528681 for the compatibility concerns.
if (documentOrigin->isUnique() || documentOrigin->isLocal())
- return equalIgnoringFragmentIdentifier(url, documentURL);
+ return equalIgnoringQueryAndFragment(url, documentURL);
if (!equalIgnoringPathQueryAndFragment(url, documentURL))
return false;
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-whitelisted-at-unique-origin-denied.php ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698