Chromium Code Reviews| 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..09096774e0e7ed7743c97440421b80d95f8d0275 100644 |
| --- a/third_party/WebKit/Source/core/frame/History.cpp |
| +++ b/third_party/WebKit/Source/core/frame/History.cpp |
| @@ -59,6 +59,22 @@ bool equalIgnoringPathQueryAndFragment(const KURL& a, const KURL& b) |
| return true; |
| } |
| +bool equalIgnoringQueryAndFragment(const KURL& a, const KURL& b) |
| +{ |
| + int aLength = (a.parsed().query.len >= 0) ? (a.parsed().query.begin - 1) : ((a.parsed().ref.len >= 0) ? (a.parsed().ref.begin - 1) : (a.getString().length())); |
|
Mike West
2016/06/16 09:23:13
Is `a.pathEnd()` not correct here? I don't underst
Peng Xinchao
2016/06/17 11:09:52
Done.
You are right , i misunderstand path of URL
|
| + int bLength = (b.parsed().query.len >= 0) ? (b.parsed().query.begin - 1) : ((b.parsed().ref.len >= 0) ? (b.parsed().ref.begin - 1) : (b.getString().length())); |
|
Mike West
2016/06/16 09:23:13
Ditto.
|
| + |
| + 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; |
| +} |
|
Mike West
2016/06/16 09:23:13
Nit: Newline.
Peng Xinchao
2016/06/17 11:09:52
Done.
|
| } // namespace |
| History::History(LocalFrame* frame) |
| @@ -196,7 +212,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; |