зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1731050 - Stop displaying hidden tabs in Recent Tabs popup. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D134939
This commit is contained in:
Родитель
dda53ce32f
Коммит
b8e3aad1a3
|
@ -575,6 +575,13 @@ var ctrlTab = {
|
|||
this.removeClosingTabFromUI(event.target);
|
||||
}
|
||||
break;
|
||||
case "TabHide":
|
||||
this.detachTab(event.target);
|
||||
break;
|
||||
case "TabShow":
|
||||
this.attachTab(event.target);
|
||||
this._sortRecentlyUsedTabs();
|
||||
break;
|
||||
case "keydown":
|
||||
this.onKeyDown(event);
|
||||
break;
|
||||
|
@ -640,11 +647,17 @@ var ctrlTab = {
|
|||
|
||||
aCallback(urls);
|
||||
},
|
||||
|
||||
_sortRecentlyUsedTabs() {
|
||||
this._recentlyUsedTabs.sort(
|
||||
(tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed
|
||||
);
|
||||
},
|
||||
_initRecentlyUsedTabs() {
|
||||
this._recentlyUsedTabs = Array.prototype.filter
|
||||
.call(gBrowser.tabs, tab => !tab.closing)
|
||||
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);
|
||||
this._recentlyUsedTabs = Array.prototype.filter.call(
|
||||
gBrowser.tabs,
|
||||
tab => !tab.closing && !tab.hidden
|
||||
);
|
||||
this._sortRecentlyUsedTabs();
|
||||
},
|
||||
|
||||
_init: function ctrlTab__init(enable) {
|
||||
|
@ -659,6 +672,8 @@ var ctrlTab = {
|
|||
tabContainer[toggleEventListener]("TabAttrModified", this);
|
||||
tabContainer[toggleEventListener]("TabSelect", this);
|
||||
tabContainer[toggleEventListener]("TabClose", this);
|
||||
tabContainer[toggleEventListener]("TabHide", this);
|
||||
tabContainer[toggleEventListener]("TabShow", this);
|
||||
|
||||
if (enable) {
|
||||
Services.els.addSystemEventListener(document, "keydown", this, false);
|
||||
|
|
|
@ -143,6 +143,43 @@ add_task(async function() {
|
|||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-lone-blocks
|
||||
{
|
||||
// Bug 1731050: test hidden tabs
|
||||
info("Starting hidden tabs test");
|
||||
checkTabs(1);
|
||||
await BrowserTestUtils.addTab(gBrowser);
|
||||
await BrowserTestUtils.addTab(gBrowser);
|
||||
await BrowserTestUtils.addTab(gBrowser);
|
||||
await BrowserTestUtils.addTab(gBrowser);
|
||||
|
||||
selectTabs([1, 2, 3, 4, 3]);
|
||||
gBrowser.hideTab(gBrowser.tabs[4]);
|
||||
selectTabs([2]);
|
||||
gBrowser.hideTab(gBrowser.tabs[3]);
|
||||
|
||||
is(gBrowser.tabs[4].hidden, true, "Tab at index 4 is hidden");
|
||||
is(gBrowser.tabs[3].hidden, true, "Tab at index 3 is hidden");
|
||||
is(gBrowser.tabs[2].hidden, false, "Tab at index 2 is still shown");
|
||||
is(gBrowser.tabs[1].hidden, false, "Tab at index 1 is still shown");
|
||||
is(gBrowser.tabs[0].hidden, false, "Tab at index 0 is still shown");
|
||||
|
||||
ctrlTabTest([], 1, 1);
|
||||
ctrlTabTest([], 2, 1);
|
||||
gBrowser.showTab(gBrowser.tabs[4]);
|
||||
ctrlTabTest([2], 3, 4);
|
||||
ctrlTabTest([], 5, 4);
|
||||
gBrowser.showTab(gBrowser.tabs[3]);
|
||||
ctrlTabTest([], 4, 3);
|
||||
ctrlTabTest([], 6, 4);
|
||||
|
||||
await BrowserTestUtils.removeTab(gBrowser.tabs[4]);
|
||||
await BrowserTestUtils.removeTab(gBrowser.tabs[3]);
|
||||
await BrowserTestUtils.removeTab(gBrowser.tabs[2]);
|
||||
await BrowserTestUtils.removeTab(gBrowser.tabs[1]);
|
||||
info("End hidden tabs test");
|
||||
}
|
||||
|
||||
/* private utility functions */
|
||||
|
||||
function pressCtrlTab(aShiftKey) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче