summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 16:09:15 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 16:09:15 +0000
commit5658085787ca5a424ef86d6ad8d9c2cf2bf80ad8 (patch)
treec81bf583b059eca1d0a041c04db37f883f634ba3 /chrome/browser/ui/browser.cc
parent1a0e1883f8cc22c6f42ec3fafb663d4b73fac774 (diff)
downloadchromium_src-5658085787ca5a424ef86d6ad8d9c2cf2bf80ad8.zip
chromium_src-5658085787ca5a424ef86d6ad8d9c2cf2bf80ad8.tar.gz
chromium_src-5658085787ca5a424ef86d6ad8d9c2cf2bf80ad8.tar.bz2
Fix omnibox update bug.
When tab-switching happens, the state of the tab is stored so that it can be restored later. However, when a background tab is being closed, it doesn't cause a tab-switch, and trying to save the state causes problems in some cases (e.g. 61588). So do not save state of a background tab. BUG=61588 TEST=see bug Review URL: http://codereview.chromium.org/5075001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66445 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser.cc')
-rw-r--r--chrome/browser/ui/browser.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index f175ecb..b316536 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -4009,8 +4009,12 @@ void Browser::CloseFrame() {
void Browser::TabDetachedAtImpl(TabContents* contents, int index,
DetachType type) {
if (type == DETACH_TYPE_DETACH) {
- // Save what the user's currently typed.
- window_->GetLocationBar()->SaveStateToContents(contents);
+ // Save the current location bar state, but only if the tab being detached
+ // is the selected tab. Because saving state can conditionally revert the
+ // location bar, saving the current tab's location bar state to a
+ // non-selected tab can corrupt both tabs.
+ if (contents == GetSelectedTabContents())
+ window_->GetLocationBar()->SaveStateToContents(contents);
if (!tab_handler_->GetTabStripModel()->closing_all())
SyncHistoryWithTabs(0);