зеркало из https://github.com/mozilla/gecko-dev.git
Bug 792806 - Update list of visible tabs only once after switching to another group; r=dao
This commit is contained in:
Родитель
340472541d
Коммит
f48e05bc29
|
@ -1920,6 +1920,7 @@ let GroupItems = {
|
|||
minGroupHeight: 110,
|
||||
minGroupWidth: 125,
|
||||
_lastActiveList: null,
|
||||
_lastGroupToUpdateTabBar: null,
|
||||
|
||||
// ----------
|
||||
// Function: toString
|
||||
|
@ -2285,6 +2286,10 @@ let GroupItems = {
|
|||
});
|
||||
|
||||
this._lastActiveList.remove(groupItem);
|
||||
|
||||
if (this._lastGroupToUpdateTabBar == groupItem)
|
||||
this._lastGroupToUpdateTabBar = null;
|
||||
|
||||
UI.updateTabButton();
|
||||
},
|
||||
|
||||
|
@ -2418,8 +2423,13 @@ let GroupItems = {
|
|||
|
||||
Utils.assert(this._activeGroupItem, "There must be something to show in the tab bar!");
|
||||
|
||||
// Update list of visible tabs only once after switching to another group.
|
||||
if (this._activeGroupItem == this._lastGroupToUpdateTabBar)
|
||||
return;
|
||||
|
||||
let tabItems = this._activeGroupItem._children;
|
||||
gBrowser.showOnlyTheseTabs(tabItems.map(function(item) item.tab));
|
||||
this._lastGroupToUpdateTabBar = this._activeGroupItem;
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
@ -2537,7 +2547,7 @@ let GroupItems = {
|
|||
if (tab._tabViewTabItem.parent && tab._tabViewTabItem.parent.id == groupItemId)
|
||||
return;
|
||||
|
||||
let shouldUpdateTabBar = false;
|
||||
let shouldHideTab = false;
|
||||
let shouldShowTabView = false;
|
||||
let groupItem;
|
||||
|
||||
|
@ -2545,12 +2555,12 @@ let GroupItems = {
|
|||
if (tab.selected) {
|
||||
if (gBrowser.visibleTabs.length > 1) {
|
||||
gBrowser._blurTab(tab);
|
||||
shouldUpdateTabBar = true;
|
||||
shouldHideTab = true;
|
||||
} else {
|
||||
shouldShowTabView = true;
|
||||
}
|
||||
} else {
|
||||
shouldUpdateTabBar = true
|
||||
shouldHideTab = true
|
||||
}
|
||||
|
||||
// remove tab item from a groupItem
|
||||
|
@ -2573,8 +2583,8 @@ let GroupItems = {
|
|||
new GroupItem([ tab._tabViewTabItem ], { bounds: box, immediately: true });
|
||||
}
|
||||
|
||||
if (shouldUpdateTabBar)
|
||||
this._updateTabBar();
|
||||
if (shouldHideTab)
|
||||
gBrowser.hideTab(tab);
|
||||
else if (shouldShowTabView)
|
||||
UI.showTabView();
|
||||
},
|
||||
|
|
|
@ -99,47 +99,14 @@ function test() {
|
|||
}, aWindow);
|
||||
}
|
||||
|
||||
// [624102] check state after return from private browsing
|
||||
let testPrivateBrowsing = function (aWindow) {
|
||||
aWindow.gBrowser.loadOneTab('http://mochi.test:8888/#1', {inBackground: true});
|
||||
aWindow.gBrowser.loadOneTab('http://mochi.test:8888/#2', {inBackground: true});
|
||||
|
||||
let cw = getContentWindow(aWindow);
|
||||
let box = new cw.Rect(20, 20, 250, 200);
|
||||
let groupItem = new cw.GroupItem([], {bounds: box, immediately: true});
|
||||
cw.UI.setActive(groupItem);
|
||||
|
||||
aWindow.gBrowser.selectedTab = aWindow.gBrowser.loadOneTab('http://mochi.test:8888/#3', {inBackground: true});
|
||||
aWindow.gBrowser.loadOneTab('http://mochi.test:8888/#4', {inBackground: true});
|
||||
|
||||
afterAllTabsLoaded(function () {
|
||||
assertNumberOfVisibleTabs(aWindow, 2);
|
||||
|
||||
enterAndLeavePrivateBrowsing(function () {
|
||||
assertNumberOfVisibleTabs(aWindow, 2);
|
||||
aWindow.gBrowser.selectedTab = aWindow.gBrowser.tabs[0];
|
||||
closeGroupItem(cw.GroupItems.groupItems[1], function() {
|
||||
next(aWindow);
|
||||
});
|
||||
});
|
||||
}, aWindow);
|
||||
}
|
||||
|
||||
function testOnWindow(aIsPrivate, aCallback) {
|
||||
let win = OpenBrowserWindow({private: aIsPrivate});
|
||||
function testOnWindow(aCallback) {
|
||||
let win = OpenBrowserWindow({private: false});
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
executeSoon(function() { aCallback(win) });
|
||||
}, false);
|
||||
}
|
||||
|
||||
function enterAndLeavePrivateBrowsing(callback) {
|
||||
testOnWindow(true, function (aWindow) {
|
||||
aWindow.close();
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
// Tests for #624265
|
||||
|
@ -149,10 +116,7 @@ function test() {
|
|||
tests.push(testDuplicateTab);
|
||||
tests.push(testBackForwardDuplicateTab);
|
||||
|
||||
// Tests for #624102
|
||||
tests.push(testPrivateBrowsing);
|
||||
|
||||
testOnWindow(false, function(aWindow) {
|
||||
testOnWindow(function(aWindow) {
|
||||
loadTabView(function() {
|
||||
next(aWindow);
|
||||
}, aWindow);
|
||||
|
@ -163,4 +127,4 @@ function loadTabView(callback, aWindow) {
|
|||
showTabView(function () {
|
||||
hideTabView(callback, aWindow);
|
||||
}, aWindow);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче