Backed out changeset 1230bd543454 (bug 792806)
authorTim Taubert <ttaubert@mozilla.com>
Fri, 09 Aug 2013 05:50:22 +0200
changeset 154757 eab4756f594dc8d33f61990ca8466adc1443e5a0
parent 154756 68f142172838a411c8bf632c289625bf8f9a3fb9
child 154758 e881258c3ac5c56a02c89fcecdd15fcb5559678d
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs792806
milestone26.0a1
backs out1230bd54345410ce6eda9e1c743121d2a1e57900
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
Backed out changeset 1230bd543454 (bug 792806)
browser/components/tabview/groupitems.js
browser/components/tabview/test/browser_tabview_bug624265_perwindowpb.js
--- a/browser/components/tabview/groupitems.js
+++ b/browser/components/tabview/groupitems.js
@@ -1915,17 +1915,16 @@ let GroupItems = {
   _arrangePaused: false,
   _arrangesPending: [],
   _removingHiddenGroups: false,
   _delayedModUpdates: [],
   _autoclosePaused: false,
   minGroupHeight: 110,
   minGroupWidth: 125,
   _lastActiveList: null,
-  _lastGroupToUpdateTabBar: null,
 
   // ----------
   // Function: toString
   // Prints [GroupItems] for debug use
   toString: function GroupItems_toString() {
     return "[GroupItems count=" + this.groupItems.length + "]";
   },
 
@@ -2281,20 +2280,16 @@ let GroupItems = {
     if (groupItem == this._activeGroupItem)
       this._activeGroupItem = null;
 
     this._arrangesPending = this._arrangesPending.filter(function (pending) {
       return groupItem != pending.groupItem;
     });
 
     this._lastActiveList.remove(groupItem);
-
-    if (this._lastGroupToUpdateTabBar == groupItem)
-      this._lastGroupToUpdateTabBar = null;
-
     UI.updateTabButton();
   },
 
   // ----------
   // Function: groupItem
   // Given some sort of identifier, returns the appropriate groupItem.
   // Currently only supports groupItem ids.
   groupItem: function GroupItems_groupItem(a) {
@@ -2418,23 +2413,18 @@ let GroupItems = {
   // Function: _updateTabBar
   // Hides and shows tabs in the tab bar based on the active groupItem
   _updateTabBar: function GroupItems__updateTabBar() {
     if (!window.UI)
       return; // called too soon
 
     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;
   },
 
   // ----------
   // Function: updateActiveGroupItemAndTabBar
   // Sets active TabItem and GroupItem, and updates tab bar appropriately.
   // Parameters:
   // tabItem - the tab item
   // options - is passed to UI.setActive() directly
@@ -2542,30 +2532,30 @@ let GroupItems = {
       return;
 
     Utils.assertThrow(tab._tabViewTabItem, "tab must be linked to a TabItem");
 
     // given tab is already contained in target group
     if (tab._tabViewTabItem.parent && tab._tabViewTabItem.parent.id == groupItemId)
       return;
 
-    let shouldHideTab = false;
+    let shouldUpdateTabBar = false;
     let shouldShowTabView = false;
     let groupItem;
 
     // switch to the appropriate tab first.
     if (tab.selected) {
       if (gBrowser.visibleTabs.length > 1) {
         gBrowser._blurTab(tab);
-        shouldHideTab = true;
+        shouldUpdateTabBar = true;
       } else {
         shouldShowTabView = true;
       }
     } else {
-      shouldHideTab = true
+      shouldUpdateTabBar = true
     }
 
     // remove tab item from a groupItem
     if (tab._tabViewTabItem.parent)
       tab._tabViewTabItem.parent.remove(tab._tabViewTabItem);
 
     // add tab item to a groupItem
     if (groupItemId) {
@@ -2578,18 +2568,18 @@ let GroupItems = {
 
       let box = new Rect(pageBounds);
       box.width = 250;
       box.height = 200;
 
       new GroupItem([ tab._tabViewTabItem ], { bounds: box, immediately: true });
     }
 
-    if (shouldHideTab)
-      gBrowser.hideTab(tab);
+    if (shouldUpdateTabBar)
+      this._updateTabBar();
     else if (shouldShowTabView)
       UI.showTabView();
   },
 
   // ----------
   // Function: removeHiddenGroups
   // Removes all hidden groups' data and its browser tabs.
   removeHiddenGroups: function GroupItems_removeHiddenGroups() {
--- a/browser/components/tabview/test/browser_tabview_bug624265_perwindowpb.js
+++ b/browser/components/tabview/test/browser_tabview_bug624265_perwindowpb.js
@@ -94,37 +94,73 @@ function test() {
             assertOneSingleGroupItem(aWindow);
             next(aWindow);
           }, aWindow);
         }, aWindow);
       }, aWindow);
     }, aWindow);
   }
 
-  function testOnWindow(aCallback) {
-    let win = OpenBrowserWindow({private: false});
+  // [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});
     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
   tests.push(testUndoCloseTabs);
 
   // Tests for #623792
   tests.push(testDuplicateTab);
   tests.push(testBackForwardDuplicateTab);
 
-  testOnWindow(function(aWindow) {
+  // Tests for #624102
+  tests.push(testPrivateBrowsing);
+
+  testOnWindow(false, function(aWindow) {
     loadTabView(function() {
       next(aWindow);
     }, aWindow);
   });
 }
 
 function loadTabView(callback, aWindow) {
   showTabView(function () {
     hideTabView(callback, aWindow);
   }, aWindow);
-}
+}
\ No newline at end of file