Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 3d8f3c58817471e6b3de4e7720c35a2efc163ddc..9a0e61140918411bb4c9f0b3931c465a1880821f 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -4010,8 +4010,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); |