Bug 630102 - The unpinned tab doesn't display in the correct place in Panorama view [r=ian, a=sdwilsh]
authorRaymond Lee <raymond@raysquare.com>
Thu, 03 Feb 2011 23:59:27 +0800
changeset 61857 490e39e1d9569f606e3ff5675c9569b4c7b8529d
parent 61856 602d24b981e53778e7dc5fcc0fee212f6c8af716
child 61858 54da8f75df7f9d2a91d9a16019c850f25994c6a3
push id18522
push usereakhgari@mozilla.com
push dateThu, 03 Feb 2011 17:29:54 +0000
treeherdermozilla-central@3c87074d5f50 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersian, sdwilsh
bugs630102
milestone2.0b12pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 630102 - The unpinned tab doesn't display in the correct place in Panorama view [r=ian, a=sdwilsh]
browser/base/content/tabview/ui.js
browser/base/content/test/tabview/Makefile.in
browser/base/content/test/tabview/browser_tabview_bug630102.js
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -776,16 +776,20 @@ let UI = {
 
     // TabUnpinned
     this._eventListeners.unpinned = function(tab) {
       if (tab.ownerDocument.defaultView != gWindow)
         return;
 
       TabItems.handleTabUnpin(tab);
       GroupItems.removeAppTab(tab);
+
+      let groupItem = tab._tabViewTabItem.parent;
+      if (groupItem)
+        self.setReorderTabItemsOnShow(groupItem);
     };
 
     // Actually register the above handlers
     for (let name in this._eventListeners)
       AllTabs.register(name, this._eventListeners[name]);
   },
 
   // ----------
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -95,16 +95,17 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug625269.js \
                  browser_tabview_bug625424.js \
                  browser_tabview_bug626368.js \
                  browser_tabview_bug627288.js \
                  browser_tabview_bug627736.js \
                  browser_tabview_bug628165.js \
                  browser_tabview_bug628270.js \
                  browser_tabview_bug629195.js \
+                 browser_tabview_bug630102.js \
                  browser_tabview_dragdrop.js \
                  browser_tabview_exit_button.js \
                  browser_tabview_expander.js \
                  browser_tabview_group.js \
                  browser_tabview_launch.js \
                  browser_tabview_multiwindow_search.js \
                  browser_tabview_orphaned_tabs.js \
                  browser_tabview_privatebrowsing.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug630102.js
@@ -0,0 +1,64 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+  waitForExplicitFinish();
+
+  let originalTab = gBrowser.visibleTabs[0];
+  let newTab1 = gBrowser.addTab("about:blank", { skipAnimation: true });
+  let newTab2 = gBrowser.addTab("about:blank", { skipAnimation: true });
+  
+  gBrowser.pinTab(newTab1);
+  
+  let contentWindow;
+
+  let partOne = function() {
+    window.removeEventListener("tabviewshown", partOne, false);
+
+    contentWindow = document.getElementById("tab-view").contentWindow;
+    is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item");
+
+    let groupItem = contentWindow.GroupItems.groupItems[0];
+    let tabItems = groupItem.getChildren();
+    is(tabItems.length, 2, "There are two tab items in that group item");
+    is(tabItems[0].tab, originalTab, "The first tab item is linked to the first tab");
+    is(tabItems[1].tab, newTab2, "The second tab item is linked to the second tab");
+
+    window.addEventListener("tabviewhidden", partTwo, false);
+    TabView.toggle();
+  };
+
+  let partTwo = function() {
+    window.removeEventListener("tabviewhidden", partTwo, false);
+
+    gBrowser.unpinTab(newTab1);
+
+    window.addEventListener("tabviewshown", partThree, false);
+    TabView.toggle();
+  };
+
+  let partThree = function() {
+    window.removeEventListener("tabviewshown", partThree, false);
+
+    let tabItems = contentWindow.GroupItems.groupItems[0].getChildren();
+    is(tabItems.length, 3, "There are three tab items in that group item");
+    is(tabItems[0].tab, gBrowser.visibleTabs[0], "The first tab item is linked to the first tab");
+    is(tabItems[1].tab, gBrowser.visibleTabs[1], "The second tab item is linked to the second tab");
+    is(tabItems[2].tab, gBrowser.visibleTabs[2], "The third tab item is linked to the third tab");
+
+    window.addEventListener("tabviewhidden", endGame, false);
+    TabView.toggle();
+  };
+
+  let endGame = function() {
+    window.removeEventListener("tabviewhidden", endGame, false);
+
+    gBrowser.removeTab(newTab1);
+    gBrowser.removeTab(newTab2);
+
+    finish();
+  };
+
+  window.addEventListener("tabviewshown", partOne, false);
+  TabView.toggle();
+}