Commit 6ad827ae authored by davidben@chromium.org's avatar davidben@chromium.org

Don't pushState when setting the search page to itself.

Calling pushState when the search page is shown causes history entries after
the current one to be lost.

This mimics the pre-r271538 behavior where it set location.hash. Setting
location.hash is a no-op (rather than pushing a duplicate history entry) if the
hash has not changed.

BUG=401004

Review URL: https://codereview.chromium.org/446093002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287892 0039d316-1c4b-4281-b951-d872f2087c98
parent dc06f75b
...@@ -267,10 +267,12 @@ cr.define('options', function() { ...@@ -267,10 +267,12 @@ cr.define('options', function() {
// Cleanup the search query string. // Cleanup the search query string.
text = SearchPage.canonicalizeQuery(text); text = SearchPage.canonicalizeQuery(text);
// Set the hash on the current page, and the enclosing uber page // Set the hash on the current page, and the enclosing uber page. Only do
// this if the page is not current. See https://crbug.com/401004.
var hash = text ? '#' + encodeURIComponent(text) : ''; var hash = text ? '#' + encodeURIComponent(text) : '';
var path = text ? this.name : ''; var path = text ? this.name : '';
uber.pushState({}, path + hash); if (location.hash != hash || location.pathname != '/' + path)
uber.pushState({}, path + hash);
// Toggle the search page if necessary. // Toggle the search page if necessary.
if (text) { if (text) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment