diff --git a/browser/base/content/tabview/groupitems.js b/browser/base/content/tabview/groupitems.js index edaf06a1df6..7b1fe85ae9c 100644 --- a/browser/base/content/tabview/groupitems.js +++ b/browser/base/content/tabview/groupitems.js @@ -1086,7 +1086,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), { // tabItem - The tabItem that is closed. _onChildClose: function GroupItem__onChildClose(tabItem) { let count = this._children.length; - let dontArrange = this.expanded || !this.shouldStack(count); + let dontArrange = tabItem.closedManually && + (this.expanded || !this.shouldStack(count)); let dontClose = !tabItem.closedManually && gBrowser._numPinnedTabs > 0; this.remove(tabItem, {dontArrange: dontArrange, dontClose: dontClose}); diff --git a/browser/base/content/test/tabview/browser_tabview_bug610208.js b/browser/base/content/test/tabview/browser_tabview_bug610208.js index b8de437b5c4..0e79467ea62 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug610208.js +++ b/browser/base/content/test/tabview/browser_tabview_bug610208.js @@ -18,12 +18,16 @@ function test() { finish(); } + let closeTabItemManually = function (tabItem) { + EventUtils.synthesizeMouseAtCenter(tabItem.container, {button: 1}, cw); + } + let prepareTest = function (testName) { let originalBounds = groupItem.getChild(0).getBounds(); let tabItem = groupItem.getChild(1); let bounds = tabItem.getBounds(); - tabItem.close(); + closeTabItemManually(tabItem); ok(originalBounds.equals(groupItem.getChild(0).getBounds()), testName + ': tabs did not change their size'); ok(bounds.equals(groupItem.getChild(1).getBounds()), testName + ': third tab is now on second tab\'s previous position'); @@ -180,7 +184,7 @@ function test() { let bounds = tabItem.getBounds(); while (groupItem.getChildren().length > 2) - groupItem.getChild(1).close(); + closeTabItemManually(groupItem.getChild(1)); ok(originalBounds.equals(groupItem.getChild(0).getBounds()), 'testExpandedMode: tabs did not change their size'); diff --git a/browser/base/content/test/tabview/browser_tabview_bug662266.js b/browser/base/content/test/tabview/browser_tabview_bug662266.js index 95659466d48..812b4592a77 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug662266.js +++ b/browser/base/content/test/tabview/browser_tabview_bug662266.js @@ -27,7 +27,7 @@ function test() { // remove two tabs and see if the remaining tabs are re-arranged to fill // the resulting gaps for (let i = 0; i < 2; i++) { - children[1].close(); + EventUtils.synthesizeMouseAtCenter(children[1].container, {button: 1}, cw); ok(bounds.equals(children[1].getBounds()), "tabItems were re-arranged"); } diff --git a/browser/base/content/test/tabview/browser_tabview_bug665502.js b/browser/base/content/test/tabview/browser_tabview_bug665502.js index bf986dd1c7b..528c421d30b 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug665502.js +++ b/browser/base/content/test/tabview/browser_tabview_bug665502.js @@ -21,7 +21,7 @@ function test() { let bounds = tabItem.getBounds(); is(groupItem.getActiveTab(), tabItem, "the first tab is active"); - tabItem.close(); + EventUtils.synthesizeMouseAtCenter(tabItem.container, {button: 1}, cw); is(groupItem.getChildren().indexOf(tabItem), -1, "tabItem got removed"); ok(bounds.equals(groupItem.getChild(0).getBounds()), "tabItem bounds didn't change");