diff --git a/browser/base/content/tabview/groupitems.js b/browser/base/content/tabview/groupitems.js index 619fc59088f..51ee2deae7d 100644 --- a/browser/base/content/tabview/groupitems.js +++ b/browser/base/content/tabview/groupitems.js @@ -576,6 +576,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), { } }); + this.droppable(false); this._createUndoButton(); } else this.close(); @@ -632,6 +633,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), { this.hidden = false; this.$undoContainer.remove(); this.$undoContainer = null; + this.droppable(true); iQ(this.container).show().animate({ "-moz-transform": "scale(1)", diff --git a/browser/base/content/test/tabview/Makefile.in b/browser/base/content/test/tabview/Makefile.in index b2277786f67..3c111c7f38e 100644 --- a/browser/base/content/test/tabview/Makefile.in +++ b/browser/base/content/test/tabview/Makefile.in @@ -92,6 +92,7 @@ _BROWSER_FILES = \ browser_tabview_bug624727.js \ browser_tabview_bug624953.js \ browser_tabview_bug625269.js \ + browser_tabview_bug625424.js \ browser_tabview_bug626368.js \ browser_tabview_bug627288.js \ browser_tabview_bug627736.js \ diff --git a/browser/base/content/test/tabview/browser_tabview_bug625424.js b/browser/base/content/test/tabview/browser_tabview_bug625424.js new file mode 100644 index 00000000000..1012421d45e --- /dev/null +++ b/browser/base/content/test/tabview/browser_tabview_bug625424.js @@ -0,0 +1,89 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function test() { + let win; + let cw; + + let getGroupItem = function (index) { + return cw.GroupItems.groupItems[index]; + } + + let createOrphan = function (callback) { + let tab = win.gBrowser.loadOneTab('about:blank', {inBackground: true}); + afterAllTabsLoaded(function () { + let tabItem = tab._tabViewTabItem; + tabItem.parent.remove(tabItem); + callback(tabItem); + }); + } + + let hideGroupItem = function (groupItem, callback) { + groupItem.addSubscriber(groupItem, 'groupHidden', function () { + groupItem.removeSubscriber(groupItem, 'groupHidden'); + callback(); + }); + groupItem.closeAll(); + } + + let newWindow = function (test) { + newWindowWithTabView(function (tvwin) { + registerCleanupFunction(function () { + if (!tvwin.closed) + tvwin.close(); + }); + + win = tvwin; + cw = win.TabView.getContentWindow(); + test(); + }); + } + + let assertNumberOfTabsInGroupItem = function (groupItem, numTabs) { + is(groupItem.getChildren().length, numTabs, + 'there are ' + numTabs + ' tabs in this groupItem'); + } + + let testDragOnHiddenGroup = function () { + createOrphan(function (orphan) { + let groupItem = getGroupItem(0); + hideGroupItem(groupItem, function () { + let drag = orphan.container; + let drop = groupItem.$undoContainer[0]; + + assertNumberOfTabsInGroupItem(groupItem, 1); + + EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw); + EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw); + EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw); + + assertNumberOfTabsInGroupItem(groupItem, 1); + + win.close(); + newWindow(testDragOnVisibleGroup); + }); + }); + } + + let testDragOnVisibleGroup = function () { + createOrphan(function (orphan) { + let groupItem = getGroupItem(0); + let drag = orphan.container; + let drop = groupItem.container; + + assertNumberOfTabsInGroupItem(groupItem, 1); + + EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw); + EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw); + EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw); + + assertNumberOfTabsInGroupItem(groupItem, 2); + + win.close(); + finish(); + }); + } + + waitForExplicitFinish(); + newWindow(testDragOnHiddenGroup); +}