Bug 594644 part 2 r=dietrich a=blocking
authorIan Gilman <ian@iangilman.com>
Mon, 22 Nov 2010 16:28:38 -0800
changeset 60033 ccfc9d2147038b5422ddce218b03092028aabe0e
parent 60032 b06a94065ef0726698fe6c42c706c8ddbe601f84
child 60034 8bb78383bdb6b7c77cb3193c99dd9e3fab429889
push id17837
push userian@iangilman.com
push dateWed, 05 Jan 2011 20:59:13 +0000
treeherdermozilla-central@f453924d5fe1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdietrich, blocking
bugs594644
milestone2.0b9pre
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 594644 part 2 r=dietrich a=blocking
browser/base/content/tabview/groupitems.js
browser/base/content/tabview/ui.js
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -1554,16 +1554,17 @@ let GroupItems = {
   nextID: 1,
   _inited: false,
   _activeGroupItem: null,
   _activeOrphanTab: null,
   _cleanupFunctions: [],
   _arrangePaused: false,
   _arrangesPending: [],
   _removingHiddenGroups: false,
+  _updatingTabBarPaused: false,
 
   // ----------
   // Function: init
   init: function GroupItems_init() {
     let self = this;
 
     // setup attr modified handler, and prepare for its uninit
     function handleAttrModified(xulTab) {
@@ -1987,22 +1988,44 @@ let GroupItems = {
   //
   // Paramaters:
   //  groupItem - the active <TabItem> or <null>
   setActiveOrphanTab: function GroupItems_setActiveOrphanTab(tabItem) {
     this._activeOrphanTab = tabItem;
   },
 
   // ----------
+  // Function: pauseUpdatingTabBar
+  // Don't update the tab bar until resume is called.
+  pauseUpdatingTabBar: function GroupItems_pauseUdatingTabBar() {
+    Utils.assertThrow(!this._updatingTabBarPaused, "shouldn't already be paused");
+
+    this._updatingTabBarPaused = true;
+  },
+  
+  // ----------
+  // Function: resumeUpdatingTabBar
+  // Allows updating the tab bar, and does an update.
+  resumeUpdatingTabBar: function GroupItems_resumeUpdatingTabBar() {
+    Utils.assertThrow(this._updatingTabBarPaused, "should already be paused");
+
+    this._updatingTabBarPaused = false;
+    this._updateTabBar();
+  },
+  
+  // ----------
   // Function: _updateTabBar
   // Hides and shows tabs in the tab bar based on the active groupItem or
   // currently active orphan tabItem
   _updateTabBar: function GroupItems__updateTabBar() {
     if (!window.UI)
       return; // called too soon
+      
+    if (this._updatingTabBarPaused)
+      return;
 
     if (!this._activeGroupItem && !this._activeOrphanTab) {
       Utils.assert(false, "There must be something to show in the tab bar!");
       return;
     }
 
     let tabItems = this._activeGroupItem == null ?
       [this._activeOrphanTab] : this._activeGroupItem._children;
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -532,16 +532,17 @@ let UI = {
       else if (self._privateBrowsing.transitionStage == 3) {
         if (self._privateBrowsing.transitionMode == "exit" &&
             self._privateBrowsing.wasInTabView)
           self.showTabView(false);
 
         self._privateBrowsing.transitionStage = 0;
         self._privateBrowsing.transitionMode = "";
         TabItems.resumeReconnecting();
+        GroupItems.resumeUpdatingTabBar();
       }
     }
 
     Services.obs.addObserver(srObserver, "sessionstore-browser-state-restored", false);
 
     this._cleanupFunctions.push(function() {
       Services.obs.removeObserver(srObserver, "sessionstore-browser-state-restored");
     });
@@ -566,16 +567,17 @@ let UI = {
           self._privateBrowsing.wasInTabView = self.isTabViewVisible();
           if (self.isTabViewVisible())
             self.goToTab(gBrowser.selectedTab);
         }
       } else if (aTopic == "private-browsing-change-granted") {
         if (aData == "enter" || aData == "exit") {
           self._privateBrowsing.transitionStage = 1;
           self._privateBrowsing.transitionMode = aData;
+          GroupItems.pauseUpdatingTabBar();
           TabItems.pauseReconnecting();
         }
       }
     }
 
     Services.obs.addObserver(pbObserver, "private-browsing", false);
     Services.obs.addObserver(pbObserver, "private-browsing-change-granted", false);