From ff0348d29adf2816e3afba51de1a46375e4b8cd2 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Thu, 9 Dec 2010 10:08:56 -0500 Subject: [PATCH] Bug 615271 - Ghost tab in the undo panel when opening a local page [r=mfinkle] --- mobile/chrome/content/browser.js | 11 ++++++---- mobile/chrome/content/tabs.xml | 8 ++++--- mobile/chrome/tests/browser_tabs.js | 33 +++++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 5960c959b11c..8363c6be98c9 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -534,6 +534,7 @@ var Browser = { if (hasLocal != useLocal) { let oldTab = this.selectedTab; if (currentURI == "about:blank" && !browser.canGoBack && !browser.canGoForward) { + oldTab.chromeTab.ignoreUndo = true; this.closeTab(oldTab); oldTab = null; } @@ -672,11 +673,13 @@ var Browser = { return newTab; }, - closeTab: function(tab) { - if (tab instanceof XULElement) - tab = this.getTabFromChrome(tab); + closeTab: function(aTab) { + let tab = aTab; + if (aTab instanceof XULElement) + tab = this.getTabFromChrome(aTab); - if (!tab) + // checking the length is a workaround for bug 615404 + if (!tab || this._tabs.length < 2) return; // Make sure we leave the toolbar in an unlocked state diff --git a/mobile/chrome/content/tabs.xml b/mobile/chrome/content/tabs.xml index a32a5b03bd3e..e0a328ddb64d 100644 --- a/mobile/chrome/content/tabs.xml +++ b/mobile/chrome/content/tabs.xml @@ -18,7 +18,8 @@ - + + false document.getAnonymousElementByAttribute(this, "anonid", "thumbnail"); this.parentNode.parentNode; @@ -35,7 +36,6 @@