зеркало из 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:
Родитель
a2804af3c8
Коммит
fe2024bf39
|
@ -575,6 +575,13 @@ var ctrlTab = {
|
||||||
this.removeClosingTabFromUI(event.target);
|
this.removeClosingTabFromUI(event.target);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "TabHide":
|
||||||
|
this.detachTab(event.target);
|
||||||
|
break;
|
||||||
|
case "TabShow":
|
||||||
|
this.attachTab(event.target);
|
||||||
|
this._sortRecentlyUsedTabs();
|
||||||
|
break;
|
||||||
case "keydown":
|
case "keydown":
|
||||||
this.onKeyDown(event);
|
this.onKeyDown(event);
|
||||||
break;
|
break;
|
||||||
|
@ -640,11 +647,17 @@ var ctrlTab = {
|
||||||
|
|
||||||
aCallback(urls);
|
aCallback(urls);
|
||||||
},
|
},
|
||||||
|
_sortRecentlyUsedTabs() {
|
||||||
|
this._recentlyUsedTabs.sort(
|
||||||
|
(tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed
|
||||||
|
);
|
||||||
|
},
|
||||||
_initRecentlyUsedTabs() {
|
_initRecentlyUsedTabs() {
|
||||||
this._recentlyUsedTabs = Array.prototype.filter
|
this._recentlyUsedTabs = Array.prototype.filter.call(
|
||||||
.call(gBrowser.tabs, tab => !tab.closing)
|
gBrowser.tabs,
|
||||||
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);
|
tab => !tab.closing && !tab.hidden
|
||||||
|
);
|
||||||
|
this._sortRecentlyUsedTabs();
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function ctrlTab__init(enable) {
|
_init: function ctrlTab__init(enable) {
|
||||||
|
@ -659,6 +672,8 @@ var ctrlTab = {
|
||||||
tabContainer[toggleEventListener]("TabAttrModified", this);
|
tabContainer[toggleEventListener]("TabAttrModified", this);
|
||||||
tabContainer[toggleEventListener]("TabSelect", this);
|
tabContainer[toggleEventListener]("TabSelect", this);
|
||||||
tabContainer[toggleEventListener]("TabClose", this);
|
tabContainer[toggleEventListener]("TabClose", this);
|
||||||
|
tabContainer[toggleEventListener]("TabHide", this);
|
||||||
|
tabContainer[toggleEventListener]("TabShow", this);
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
Services.els.addSystemEventListener(document, "keydown", this, false);
|
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");
|
||||||
|
|
||||||
|
await ctrlTabTest([], 1, 1);
|
||||||
|
await ctrlTabTest([], 2, 0);
|
||||||
|
gBrowser.showTab(gBrowser.tabs[4]);
|
||||||
|
await ctrlTabTest([2], 3, 4);
|
||||||
|
await ctrlTabTest([], 5, 4);
|
||||||
|
gBrowser.showTab(gBrowser.tabs[3]);
|
||||||
|
await ctrlTabTest([], 4, 3);
|
||||||
|
await 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 */
|
/* private utility functions */
|
||||||
|
|
||||||
function pressCtrlTab(aShiftKey) {
|
function pressCtrlTab(aShiftKey) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче