diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index 3907daed592f..f92e2639b439 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -504,12 +504,21 @@ function HistoryMenu(aPopupShowingEvent) { } HistoryMenu.prototype = { + _getClosedTabCount() { + // SessionStore doesn't track the hidden window, so just return zero then. + if (window == Services.appShell.hiddenDOMWindow) { + return 0; + } + + return SessionStore.getClosedTabCount(window); + }, + toggleRecentlyClosedTabs: function HM_toggleRecentlyClosedTabs() { // enable/disable the Recently Closed Tabs sub menu var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0]; // no restorable tabs, so disable menu - if (SessionStore.getClosedTabCount(window) == 0) + if (this._getClosedTabCount() == 0) undoMenu.setAttribute("disabled", true); else undoMenu.removeAttribute("disabled"); @@ -527,7 +536,7 @@ HistoryMenu.prototype = { undoPopup.removeChild(undoPopup.firstChild); // no restorable tabs, so make sure menu is disabled, and return - if (SessionStore.getClosedTabCount(window) == 0) { + if (this._getClosedTabCount() == 0) { undoMenu.setAttribute("disabled", true); return; }