зеркало из https://github.com/mozilla/pjs.git
Backout changeset 646f3f6f3cd5 (bug 663421)
This commit is contained in:
Родитель
1b7f3ea4c1
Коммит
3363f50290
|
@ -355,8 +355,10 @@ let TabView = {
|
|||
if (!tabItem)
|
||||
return;
|
||||
|
||||
// Switch to the new tab
|
||||
// Switch to the new tab, and close the old group if it's now empty.
|
||||
let oldGroupItem = groupItems.getActiveGroupItem();
|
||||
window.gBrowser.selectedTab = tabItem.tab;
|
||||
oldGroupItem.closeIfEmpty();
|
||||
});
|
||||
}
|
||||
}, true);
|
||||
|
|
|
@ -282,6 +282,11 @@ Drag.prototype = {
|
|||
Trenches.hideGuides();
|
||||
this.item.isDragging = false;
|
||||
|
||||
if (this.parent && this.parent != this.item.parent &&
|
||||
this.parent.isEmpty()) {
|
||||
this.parent.close();
|
||||
}
|
||||
|
||||
if (this.parent && this.parent.expanded)
|
||||
this.parent.arrange();
|
||||
|
||||
|
|
|
@ -649,7 +649,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
// Options:
|
||||
// immediately - (bool) if true, no animation will be used
|
||||
close: function GroupItem_close(options) {
|
||||
this.removeAll();
|
||||
this.removeAll({dontClose: true});
|
||||
GroupItems.unregister(this);
|
||||
|
||||
// remove unfreeze event handlers, if item size is frozen
|
||||
|
@ -723,6 +723,21 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
UI.setActive(closestTabItem);
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: closeIfEmpty
|
||||
// Closes the group if it's empty, has no title, is closable, and
|
||||
// autoclose is enabled (see pauseAutoclose()). Returns true if the close
|
||||
// occurred and false otherwise.
|
||||
closeIfEmpty: function() {
|
||||
if (!this._children.length && !this.getTitle() &&
|
||||
!GroupItems.getUnclosableGroupItemId() &&
|
||||
!GroupItems._autoclosePaused) {
|
||||
this.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: _unhide
|
||||
// Shows the hidden group.
|
||||
|
@ -996,7 +1011,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
item.addSubscriber(this, "close", function() {
|
||||
let count = self._children.length;
|
||||
let dontArrange = self.expanded || !self.shouldStack(count);
|
||||
self.remove(item, {dontArrange: dontArrange});
|
||||
let dontClose = !item.closedManually && gBrowser._numPinnedTabs > 0;
|
||||
self.remove(item, {dontArrange: dontArrange, dontClose: dontClose});
|
||||
|
||||
if (dontArrange)
|
||||
self._freezeItemSize(count);
|
||||
|
@ -1043,6 +1059,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
//
|
||||
// Possible options:
|
||||
// dontArrange - don't rearrange the remaining items
|
||||
// dontClose - don't close the group even if it normally would
|
||||
// immediately - don't animate
|
||||
remove: function GroupItem_remove(a, options) {
|
||||
try {
|
||||
|
@ -1091,7 +1108,15 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
if (typeof item.setResizable == 'function')
|
||||
item.setResizable(true, options.immediately);
|
||||
|
||||
if (!options.dontArrange) {
|
||||
// if a blank tab is selected while restoring a tab the blank tab gets
|
||||
// removed. we need to keep the group alive for the restored tab.
|
||||
if (item.tab._tabViewTabIsRemovedAfterRestore)
|
||||
options.dontClose = true;
|
||||
|
||||
let closed = options.dontClose ? false : this.closeIfEmpty();
|
||||
if (closed)
|
||||
this._makeClosestTabActive();
|
||||
else if (!options.dontArrange) {
|
||||
this.arrange({animate: !options.immediately});
|
||||
this._unfreezeItemSize({dontArrange: true});
|
||||
}
|
||||
|
@ -1706,7 +1731,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
self.arrange();
|
||||
var groupItem = drag.info.item.parent;
|
||||
if (groupItem)
|
||||
groupItem.remove(drag.info.$el);
|
||||
groupItem.remove(drag.info.$el, {dontClose: true});
|
||||
iQ(this.container).removeClass("acceptsDrop");
|
||||
}
|
||||
|
||||
|
@ -1840,6 +1865,7 @@ let GroupItems = {
|
|||
_arrangesPending: [],
|
||||
_removingHiddenGroups: false,
|
||||
_delayedModUpdates: [],
|
||||
_autoclosePaused: false,
|
||||
minGroupHeight: 110,
|
||||
minGroupWidth: 125,
|
||||
|
||||
|
@ -2611,5 +2637,21 @@ let GroupItems = {
|
|||
return new Point(
|
||||
Math.max(size.x, GroupItems.minGroupWidth),
|
||||
Math.max(size.y, GroupItems.minGroupHeight));
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: pauseAutoclose()
|
||||
// Temporarily disable the behavior that closes groups when they become
|
||||
// empty. This is used when entering private browsing, to avoid trashing the
|
||||
// user's groups while private browsing is shuffling things around.
|
||||
pauseAutoclose: function GroupItems_pauseAutoclose() {
|
||||
this._autoclosePaused = true;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: unpauseAutoclose()
|
||||
// Re-enables the auto-close behavior.
|
||||
resumeAutoclose: function GroupItems_resumeAutoclose() {
|
||||
this._autoclosePaused = false;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -179,7 +179,7 @@ Item.prototype = {
|
|||
out: function() {
|
||||
let groupItem = drag.info.item.parent;
|
||||
if (groupItem)
|
||||
groupItem.remove(drag.info.$el);
|
||||
groupItem.remove(drag.info.$el, {dontClose: true});
|
||||
iQ(this.container).removeClass("acceptsDrop");
|
||||
},
|
||||
drop: function(event) {
|
||||
|
|
|
@ -523,9 +523,16 @@ let UI = {
|
|||
|
||||
Storage.saveVisibilityData(gWindow, "true");
|
||||
|
||||
// Close the active group if it was empty. This will happen when the
|
||||
// user returns to Panorama after looking at an app tab, having
|
||||
// closed all other tabs. (If the user is looking at an orphan tab, then
|
||||
// there is no active group for the purposes of this check.)
|
||||
let activeGroupItem = null;
|
||||
if (!UI.getActiveOrphanTab())
|
||||
if (!UI.getActiveOrphanTab()) {
|
||||
activeGroupItem = GroupItems.getActiveGroupItem();
|
||||
if (activeGroupItem && activeGroupItem.closeIfEmpty())
|
||||
activeGroupItem = null;
|
||||
}
|
||||
|
||||
if (zoomOut && currentTab && currentTab._tabViewTabItem) {
|
||||
item = currentTab._tabViewTabItem;
|
||||
|
@ -631,8 +638,10 @@ let UI = {
|
|||
// Pauses the storage activity that conflicts with sessionstore updates and
|
||||
// private browsing mode switches. Calls can be nested.
|
||||
storageBusy: function UI_storageBusy() {
|
||||
if (!this._storageBusyCount)
|
||||
if (!this._storageBusyCount) {
|
||||
TabItems.pauseReconnecting();
|
||||
GroupItems.pauseAutoclose();
|
||||
}
|
||||
|
||||
this._storageBusyCount++;
|
||||
},
|
||||
|
@ -650,6 +659,7 @@ let UI = {
|
|||
|
||||
TabItems.resumeReconnecting();
|
||||
GroupItems._updateTabBar();
|
||||
GroupItems.resumeAutoclose();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -130,7 +130,4 @@ function test() {
|
|||
is(gBrowser.tabs.length, 1, "sanity check that it matches");
|
||||
is(gBrowser.selectedTab, origTab, "got the orig tab");
|
||||
is(origTab.hidden, false, "and it's not hidden -- visible!");
|
||||
|
||||
if (tabViewWindow)
|
||||
tabViewWindow.GroupItems.groupItems[0].close();
|
||||
}
|
||||
|
|
|
@ -72,6 +72,8 @@ function testGroupSwitch(contentWindow, groupItemOne, groupItemTwo) {
|
|||
"The currently selected tab should be the second tab in the groupItemOne");
|
||||
|
||||
// cleanup.
|
||||
gBrowser.removeTab(groupItemTwo.getChild(0).tab);
|
||||
gBrowser.removeTab(newTabOne);
|
||||
closeGroupItem(groupItemTwo, finish);
|
||||
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -58,17 +58,15 @@ function onTabViewWindowLoaded() {
|
|||
gBrowser.unpinTab(appXulTab);
|
||||
gBrowser.removeTab(appXulTab);
|
||||
|
||||
ok(!groupItem.getChildren().length, "the second group is empty");
|
||||
ok(groupItem.closeIfEmpty(), "the second group was empty");
|
||||
|
||||
closeGroupItem(groupItem, function () {
|
||||
// Verify ending state
|
||||
is(gBrowser.tabs.length, 1, "we finish with one tab");
|
||||
is(contentWindow.GroupItems.groupItems.length, 1,
|
||||
"we finish with one group");
|
||||
ok(!TabView.isVisible(), "we finish with Tab View hidden");
|
||||
|
||||
finish();
|
||||
});
|
||||
// Verify ending state
|
||||
is(gBrowser.tabs.length, 1, "we finish with one tab");
|
||||
is(contentWindow.GroupItems.groupItems.length, 1,
|
||||
"we finish with one group");
|
||||
ok(!TabView.isVisible(), "we finish with Tab View hidden");
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
window.addEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
|
|
|
@ -28,15 +28,12 @@ function test() {
|
|||
EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mousemove'}, cw);
|
||||
EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mouseup'}, cw);
|
||||
|
||||
is(cw.GroupItems.groupItems.length, 2, 'there are two groupItems');
|
||||
is(sourceGroup.getChildren().length, 0, 'source group has no tabs');
|
||||
is(targetGroup.getChildren().length, 2, 'target group has two tabs');
|
||||
is(cw.GroupItems.groupItems.length, 1, 'sourceGroup was closed');
|
||||
isnot(cw.GroupItems.groupItems[0], sourceGroup, 'sourceGroup was closed');
|
||||
|
||||
targetGroup.getChild(0).close();
|
||||
|
||||
closeGroupItem(sourceGroup, function () {
|
||||
hideTabView(finish);
|
||||
});
|
||||
hideTabView(finish);
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
|
|
@ -22,13 +22,11 @@ function test() {
|
|||
"Tab width is bigger than tab clip width");
|
||||
is(gBrowser.tabContainer.getAttribute("closebuttons"), "alltabs", "Show button on all tabs.")
|
||||
|
||||
let cw = TabView.getContentWindow();
|
||||
let groupItems = cw.GroupItems.groupItems;
|
||||
is(groupItems.length, 2, "there are two groupItems");
|
||||
|
||||
// clean up and finish
|
||||
newTabs.forEach(function (tab) gBrowser.removeTab(tab));
|
||||
closeGroupItem(groupItems[1], finish);
|
||||
newTabs.forEach(function(tab) {
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ function test() {
|
|||
// make sure the tab one is selected because undoCloseTab() would remove
|
||||
// the selected tab if it's a blank tab.
|
||||
gBrowser.selectedTab = tabOne;
|
||||
showTabView(onTabViewShown);
|
||||
showTabView(onTabViewWindowLoaded);
|
||||
});
|
||||
}
|
||||
|
||||
function onTabViewShown() {
|
||||
function onTabViewWindowLoaded() {
|
||||
let contentWindow = TabView.getContentWindow();
|
||||
let groupItems = contentWindow.GroupItems.groupItems;
|
||||
is(groupItems.length, 1, "There is only one group");
|
||||
|
@ -28,7 +28,8 @@ function onTabViewShown() {
|
|||
ok(TabView.isVisible(), "Tab View is still visible after removing a tab");
|
||||
is(groupItems[0].getChildren().length, 2, "The group has two tab items");
|
||||
|
||||
restoreTab(function (tabTwo) {
|
||||
tabTwo = undoCloseTab(0);
|
||||
whenTabIsReconnected(tabTwo, function() {
|
||||
ok(TabView.isVisible(), "Tab View is still visible after restoring a tab");
|
||||
is(groupItems[0].getChildren().length, 3, "The group still has three tab items");
|
||||
|
||||
|
@ -40,3 +41,18 @@ function onTabViewShown() {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
// ----------
|
||||
function whenTabIsReconnected(tab, callback) {
|
||||
let tabItem = tab._tabViewTabItem;
|
||||
|
||||
if (tabItem._reconnected) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
tabItem.addSubscriber(tabItem, "reconnected", function () {
|
||||
tabItem.removeSubscriber(tabItem, "reconnected");
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,11 +25,12 @@ function test() {
|
|||
is(gBrowser.visibleTabs.length, 1, "The number of visible tabs is 1");
|
||||
is(gBrowser.visibleTabs[0], origTab,
|
||||
"The original tab is the only visible tab");
|
||||
|
||||
let groupItem = newTab._tabViewTabItem.parent;
|
||||
isnot(groupItem.id, newTabGroupItemId,
|
||||
isnot(newTab._tabViewTabItem.parent.id, newTabGroupItemId,
|
||||
"The moved tab item has a new group id");
|
||||
|
||||
closeGroupItem(groupItem, finish);
|
||||
// clean up
|
||||
gBrowser.removeTab(newTab);
|
||||
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -36,14 +36,12 @@ function test() {
|
|||
|
||||
// check state after adding tabItem to targetGroup
|
||||
is(tabItem.parent, targetGroup, 'tabItem changed groups');
|
||||
is(sourceGroup.getChildren().length, 0, 'source group has no children');
|
||||
is(cw.GroupItems.groupItems.length, 1, 'source group was closed automatically');
|
||||
is(targetGroup.getChildren().length, 2, 'target group has now two children');
|
||||
|
||||
// cleanup and finish
|
||||
closeGroupItem(sourceGroup, function () {
|
||||
tabItem.close();
|
||||
hideTabView(finishTest);
|
||||
});
|
||||
tabItem.close();
|
||||
hideTabView(finishTest);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,10 @@ function test() {
|
|||
is(win.gBrowser.visibleTabs.length, 1, "There is one tab displayed");
|
||||
is(cw.GroupItems.groupItems.length, 2, "There are two groups still");
|
||||
|
||||
waitForFocus(finish);
|
||||
showTabView(function () {
|
||||
is(cw.GroupItems.groupItems.length, 1, "There is now only one group");
|
||||
waitForFocus(finish);
|
||||
}, win);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -20,6 +20,23 @@ function test() {
|
|||
return groupItem;
|
||||
}
|
||||
|
||||
let hideGroupItem = function (groupItem, callback) {
|
||||
groupItem.addSubscriber(groupItem, 'groupHidden', function () {
|
||||
groupItem.removeSubscriber(groupItem, 'groupHidden');
|
||||
callback();
|
||||
});
|
||||
groupItem.closeAll();
|
||||
}
|
||||
|
||||
let closeGroupItem = function (groupItem, callback) {
|
||||
afterAllTabsLoaded(function () {
|
||||
hideGroupItem(groupItem, function () {
|
||||
groupItem.closeHidden();
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
let tests = [];
|
||||
|
||||
let next = function () {
|
||||
|
@ -197,13 +214,10 @@ function test() {
|
|||
let tabItem = groupItem.getChild(0);
|
||||
groupItem.remove(tabItem);
|
||||
|
||||
closeGroupItem(groupItem, function () {
|
||||
hideTabView(function () {
|
||||
assertNumberOfGroupItems(0);
|
||||
|
||||
hideTabView(function () {
|
||||
createGroupItem().add(tabItem);
|
||||
next();
|
||||
});
|
||||
createGroupItem().add(tabItem);
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -215,17 +229,14 @@ function test() {
|
|||
let tabItem = groupItem.getChild(0);
|
||||
groupItem.remove(tabItem);
|
||||
|
||||
closeGroupItem(groupItem, function () {
|
||||
assertNumberOfGroupItems(0);
|
||||
let newGroupItem = createGroupItem(1);
|
||||
assertNumberOfGroupItems(1);
|
||||
|
||||
closeGroupItem(newGroupItem, function () {
|
||||
assertNumberOfGroupItems(0);
|
||||
|
||||
let newGroupItem = createGroupItem(1);
|
||||
assertNumberOfGroupItems(1);
|
||||
|
||||
closeGroupItem(newGroupItem, function () {
|
||||
assertNumberOfGroupItems(0);
|
||||
createGroupItem().add(tabItem);
|
||||
hideTabView(next);
|
||||
});
|
||||
createGroupItem().add(tabItem);
|
||||
hideTabView(next);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -237,18 +248,15 @@ function test() {
|
|||
let tabItem = groupItem.getChild(0);
|
||||
groupItem.remove(tabItem);
|
||||
|
||||
closeGroupItem(groupItem, function () {
|
||||
assertNumberOfGroupItems(0);
|
||||
assertNumberOfGroupItems(0);
|
||||
let newGroupItem = createGroupItem(1);
|
||||
assertNumberOfGroupItems(1);
|
||||
|
||||
let newGroupItem = createGroupItem(1);
|
||||
assertNumberOfGroupItems(1);
|
||||
|
||||
hideGroupItem(newGroupItem, function () {
|
||||
hideTabView(function () {
|
||||
assertNumberOfGroupItems(0);
|
||||
createGroupItem().add(tabItem);
|
||||
next();
|
||||
});
|
||||
hideGroupItem(newGroupItem, function () {
|
||||
hideTabView(function () {
|
||||
assertNumberOfGroupItems(0);
|
||||
createGroupItem().add(tabItem);
|
||||
next();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -39,6 +39,10 @@ function test() {
|
|||
tests.push([tab2, tab1]);
|
||||
tests.push([tab1]);
|
||||
|
||||
// test reordering of empty groups - removes the last tab and causes
|
||||
// the groupItem to close
|
||||
tests.push([]);
|
||||
|
||||
while (tests.length) {
|
||||
let test = tests.shift();
|
||||
|
||||
|
@ -59,7 +63,7 @@ function test() {
|
|||
groupItem.reorderTabsBasedOnTabItemOrder();
|
||||
}
|
||||
|
||||
closeGroupItem(groupItem, testMoveBetweenGroups);
|
||||
testMoveBetweenGroups();
|
||||
}
|
||||
|
||||
let testMoveBetweenGroups = function () {
|
||||
|
|
|
@ -119,8 +119,7 @@ function test() {
|
|||
|
||||
enterAndLeavePrivateBrowsing(function () {
|
||||
assertNumberOfVisibleTabs(2);
|
||||
gBrowser.selectedTab = gBrowser.tabs[0];
|
||||
closeGroupItem(cw.GroupItems.groupItems[1], next);
|
||||
next();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -41,6 +41,20 @@ function test() {
|
|||
return createTab('about:blank');
|
||||
}
|
||||
|
||||
let restoreTab = function (callback) {
|
||||
let tab = undoCloseTab(0);
|
||||
|
||||
if (tab._tabViewTabItem._reconnected) {
|
||||
afterAllTabsLoaded(callback);
|
||||
return;
|
||||
}
|
||||
|
||||
tab._tabViewTabItem.addSubscriber(tab, 'reconnected', function () {
|
||||
tab._tabViewTabItem.removeSubscriber(tab, 'reconnected');
|
||||
afterAllTabsLoaded(callback);
|
||||
});
|
||||
}
|
||||
|
||||
let finishTest = function () {
|
||||
prefix = 'finish';
|
||||
assertValidPrerequisites();
|
||||
|
|
|
@ -33,10 +33,13 @@ function test() {
|
|||
ok(!document.getElementById("context_closeTab").disabled, "The 'Close tab' menu item is enabled");
|
||||
ok(!document.getElementById("context_openTabInWindow").disabled, "The 'Move to New Window' menu item is enabled");
|
||||
|
||||
let newTabTwo = gBrowser.selectedTab;
|
||||
gBrowser.selected = originalTab;
|
||||
gBrowser.removeTab(newTabOne);
|
||||
|
||||
closeGroupItem(newGroup, finish);
|
||||
gBrowser.removeTab(newTabOne);
|
||||
gBrowser.removeTab(newTabTwo);
|
||||
|
||||
finish();
|
||||
});
|
||||
let newGroup = contentWindow.GroupItems.newGroup();
|
||||
newGroup.newTab();
|
||||
|
|
|
@ -39,9 +39,7 @@ function test() {
|
|||
synthesizeMiddleMouseDrag(tabContainer, 10);
|
||||
ok(!groupItem.getChild(0), 'tabItem was closed');
|
||||
|
||||
closeGroupItem(groupItem, function () {
|
||||
hideTabView(finish);
|
||||
});
|
||||
hideTabView(finish);
|
||||
}
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
|
|
@ -25,25 +25,20 @@ function onTabViewWindowLoaded(win) {
|
|||
|
||||
is(group.getChildren().length, 1, "The group has one child now.");
|
||||
let tab = group.getChild(0);
|
||||
|
||||
function finalize() {
|
||||
is(contentWindow.GroupItems.getActiveGroupItem(), originalGroup,
|
||||
"The original group is active.");
|
||||
is(contentWindow.UI.getActiveTab(), originalTab._tabViewTabItem,
|
||||
"The original tab is active");
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
|
||||
function check() {
|
||||
if (groupOrTab == 'group') {
|
||||
group.removeSubscriber(group, "groupHidden", check);
|
||||
group.closeHidden();
|
||||
finalize();
|
||||
} else {
|
||||
} else
|
||||
tab.removeSubscriber(tab, "tabRemoved", check);
|
||||
closeGroupItem(group, finalize);
|
||||
}
|
||||
|
||||
is(contentWindow.GroupItems.getActiveGroupItem(), originalGroup,
|
||||
"The original group is active.");
|
||||
is(contentWindow.UI.getActiveTab(), originalTab._tabViewTabItem,
|
||||
"The original tab is active");
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
if (groupOrTab == 'group') {
|
||||
|
@ -63,4 +58,4 @@ function onTabViewWindowLoaded(win) {
|
|||
finish();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -25,6 +25,20 @@ function test() {
|
|||
return cw.GroupItems.groupItems[index];
|
||||
}
|
||||
|
||||
let restoreTab = function (callback) {
|
||||
let tab = undoCloseTab(0);
|
||||
|
||||
if (tab._tabViewTabItem._reconnected) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
tab._tabViewTabItem.addSubscriber(tab, 'reconnected', function () {
|
||||
tab._tabViewTabItem.removeSubscriber(tab, 'reconnected');
|
||||
afterAllTabsLoaded(callback);
|
||||
});
|
||||
}
|
||||
|
||||
let activateFirstGroupItem = function () {
|
||||
let activeTabItem = getGroupItem(0).getChild(0);
|
||||
cw.GroupItems.updateActiveGroupItemAndTabBar(activeTabItem);
|
||||
|
@ -77,7 +91,9 @@ function test() {
|
|||
assertNumberOfTabsInGroup(groupItem, 2);
|
||||
|
||||
activateFirstGroupItem();
|
||||
closeGroupItem(groupItem, finishTest);
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||
finishTest();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ function addTest(contentWindow, groupOneId, groupTwoId, originalTab) {
|
|||
};
|
||||
groupTwo.addSubscriber(groupTwo, "close", function() {
|
||||
groupTwo.removeSubscriber(groupTwo, "close");
|
||||
closeGroupItem(groupOne, finish);
|
||||
finish();
|
||||
});
|
||||
window.addEventListener("tabviewhidden", onTabViewHidden, false);
|
||||
gBrowser.selectedTab = originalTab;
|
||||
|
|
|
@ -95,7 +95,7 @@ function testGroupItemWithTabItem(contentWindow) {
|
|||
let endGame = function() {
|
||||
window.removeEventListener("tabviewhidden", endGame, false);
|
||||
ok(!TabView.isVisible(), "Tab View is hidden");
|
||||
closeGroupItem(groupItem, finish);
|
||||
finish();
|
||||
};
|
||||
window.addEventListener("tabviewhidden", endGame, false);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче