Bug 973189 - Get rid of the browser.ctrlTab.recentlyUsedLimit pref. r=ttaubert

--HG--
extra : rebase_source : 353e5533fa5c88624a0c3e94170c131485841609
This commit is contained in:
Dão Gottwald 2014-02-18 14:44:31 +01:00
parent d40f6768dd
commit 6d26b1433e
2 changed files with 5 additions and 33 deletions

View File

@ -468,7 +468,6 @@ pref("browser.tabs.closeButtons", 1);
pref("browser.tabs.selectOwnerOnClose", true);
pref("browser.ctrlTab.previews", false);
pref("browser.ctrlTab.recentlyUsedLimit", 7);
// By default, do not export HTML at shutdown.
// If true, at shutdown the bookmarks in your menu and toolbar will

View File

@ -161,10 +161,6 @@ var ctrlTab = {
delete this.previews;
return this.previews = this.panel.getElementsByClassName("ctrlTab-preview");
},
get recentlyUsedLimit () {
delete this.recentlyUsedLimit;
return this.recentlyUsedLimit = gPrefService.getIntPref("browser.ctrlTab.recentlyUsedLimit");
},
get keys () {
var keys = {};
["close", "find", "selectAll"].forEach(function (key) {
@ -187,31 +183,7 @@ var ctrlTab = {
get canvasHeight () Math.round(this.canvasWidth * tabPreviews.aspectRatio),
get tabList () {
if (this._tabList)
return this._tabList;
// Using gBrowser.tabs instead of gBrowser.visibleTabs, as the latter
// exlcudes closing tabs, breaking the following loop in case the the
// selected tab is closing.
let list = Array.filter(gBrowser.tabs, function (tab) !tab.hidden);
// Rotate the list until the selected tab is first
while (!list[0].selected)
list.push(list.shift());
list = list.filter(function (tab) !tab.closing);
if (this.recentlyUsedLimit != 0) {
let recentlyUsedTabs = this._recentlyUsedTabs;
if (this.recentlyUsedLimit > 0)
recentlyUsedTabs = this._recentlyUsedTabs.slice(0, this.recentlyUsedLimit);
for (let i = recentlyUsedTabs.length - 1; i >= 0; i--) {
list.splice(list.indexOf(recentlyUsedTabs[i]), 1);
list.unshift(recentlyUsedTabs[i]);
}
}
return this._tabList = list;
return this._recentlyUsedTabs;
},
init: function ctrlTab_init() {
@ -340,6 +312,9 @@ var ctrlTab = {
},
attachTab: function ctrlTab_attachTab(aTab, aPos) {
if (aTab.closing)
return;
if (aPos == 0)
this._recentlyUsedTabs.unshift(aTab);
else if (aPos)
@ -347,6 +322,7 @@ var ctrlTab = {
else
this._recentlyUsedTabs.push(aTab);
},
detachTab: function ctrlTab_detachTab(aTab) {
var i = this._recentlyUsedTabs.indexOf(aTab);
if (i >= 0)
@ -417,8 +393,6 @@ var ctrlTab = {
Array.forEach(this.previews, function (preview) {
this.updatePreview(preview, null);
}, this);
this._tabList = null;
},
onKeyPress: function ctrlTab_onKeyPress(event) {
@ -472,7 +446,6 @@ var ctrlTab = {
return;
}
this._tabList = null;
this.updatePreviews();
if (this.selected.hidden)