Bug 604457 - switchToTabHavingURI shouldn't close selected tab or revert URL bar. r+a=gavin

This commit is contained in:
Dão Gottwald 2010-11-07 13:59:51 +01:00
parent de74f3f780
commit 3f18ac84a9
2 changed files with 7 additions and 8 deletions

View File

@ -7845,17 +7845,11 @@ function switchToTabHavingURI(aURI, aOpenNew, aCallback) {
for (let i = 0; i < browsers.length; i++) {
let browser = browsers[i];
if (browser.currentURI.equals(aURI)) {
gURLBar.handleRevert();
// We need the current tab so we can check if we should close it
let prevTab = gBrowser.selectedTab;
// Focus the matching window & tab
aWindow.focus();
aWindow.gBrowser.tabContainer.selectedIndex = i;
if (aCallback)
aCallback(browser);
// Close the previously selected tab if it was empty
if (isTabEmpty(prevTab))
gBrowser.removeTab(prevTab);
return true;
}
}

View File

@ -248,8 +248,13 @@
if (action) {
url = action.param;
if (!(aTriggeringEvent && aTriggeringEvent.altKey)) {
if (action.type == "switchtab")
switchToTabHavingURI(url);
if (action.type == "switchtab") {
this.handleRevert();
let prevTab = gBrowser.selectedTab;
if (switchToTabHavingURI(url) &&
isTabEmpty(prevTab))
gBrowser.removeTab(prevTab);
}
return;
}
}