Bug 822016 - Remove the global PB specific code from the tabview UI; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 19 Dec 2012 00:12:20 -0500
changeset 125605 dc5725f89edf46327bf8391049aeeac4180819d6
parent 125604 ccf586b1e67950cf102aace4aa00455b2a9e6af5
child 125606 df141c25462579ea7e1a3eee23ea5af7557556e6
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs822016
milestone20.0a1
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 822016 - Remove the global PB specific code from the tabview UI; r=jdm
browser/components/tabview/ui.js
--- a/browser/components/tabview/ui.js
+++ b/browser/components/tabview/ui.js
@@ -59,25 +59,27 @@ let UI = {
   _cleanupFunctions: [],
   
   // Constant: _maxInteractiveWait
   // If the UI is in the middle of an operation, this is the max amount of
   // milliseconds to wait between input events before we no longer consider
   // the operation interactive.
   _maxInteractiveWait: 250,
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
   // Variable: _privateBrowsing
   // Keeps track of info related to private browsing, including: 
   //   transitionMode - whether we're entering or exiting PB
   //   wasInTabView - whether TabView was visible before we went into PB
   _privateBrowsing: {
     transitionMode: "",
     wasInTabView: false 
   },
-  
+#endif
+
   // Variable: _storageBusy
   // Tells whether the storage is currently busy or not.
   _storageBusy: false,
 
   // Variable: isDOMWindowClosing
   // Tells wether the parent window is about to close
   isDOMWindowClosing: false,
 
@@ -590,18 +592,23 @@ let UI = {
       mainWindow.removeAttribute("activetitlebarcolor");
       mainWindow.removeAttribute("inactivetitlebarcolor");
     }
   },
 #endif
 
   // ----------
   // Function: storageBusy
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+  // Pauses the storage activity that conflicts with sessionstore updates.
+  // Calls can be nested.
+#else
   // Pauses the storage activity that conflicts with sessionstore updates and 
   // private browsing mode switches. Calls can be nested. 
+#endif
   storageBusy: function UI_storageBusy() {
     if (this._storageBusy)
       return;
 
     this._storageBusy = true;
 
     TabItems.pauseReconnecting();
     GroupItems.pauseAutoclose();
@@ -644,16 +651,17 @@ let UI = {
     gWindow.addEventListener("SSWindowStateBusy", handleSSWindowStateBusy, false);
     gWindow.addEventListener("SSWindowStateReady", handleSSWindowStateReady, false);
 
     this._cleanupFunctions.push(function() {
       gWindow.removeEventListener("SSWindowStateBusy", handleSSWindowStateBusy, false);
       gWindow.removeEventListener("SSWindowStateReady", handleSSWindowStateReady, false);
     });
 
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
     // Private Browsing:
     // When transitioning to PB, we exit Panorama if necessary (making note of the
     // fact that we were there so we can return after PB) and make sure we
     // don't reenter Panorama due to all of the session restore tab
     // manipulation (which otherwise we might). When transitioning away from
     // PB, we reenter Panorama if we had been there directly before PB.
     function pbObserver(subject, topic, data) {
       if (topic == "private-browsing") {
@@ -684,16 +692,17 @@ let UI = {
     Services.obs.addObserver(pbObserver, "private-browsing-change-granted", false);
     Services.obs.addObserver(pbObserver, "private-browsing-transition-complete", false);
 
     this._cleanupFunctions.push(function() {
       Services.obs.removeObserver(pbObserver, "private-browsing");
       Services.obs.removeObserver(pbObserver, "private-browsing-change-granted");
       Services.obs.removeObserver(pbObserver, "private-browsing-transition-complete");
     });
+#endif
 
     // TabOpen
     this._eventListeners.open = function (event) {
       let tab = event.target;
 
       // if it's an app tab, add it to all the group items
       if (tab.pinned)
         GroupItems.addAppTab(tab);
@@ -709,17 +718,21 @@ let UI = {
       if (tab.pinned)
         GroupItems.removeAppTab(tab);
         
       if (self.isTabViewVisible()) {
         // just closed the selected tab in the TabView interface.
         if (self._currentTab == tab)
           self._closedSelectedTabInTabView = true;
       } else {
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+        // If we're currently in the process of session store update,
+#else
         // If we're currently in the process of entering private browsing,
+#endif
         // we don't want to go to the Tab View UI. 
         if (self._storageBusy)
           return;
 
         // if not closing the last tab
         if (gBrowser.tabs.length > 1) {
           // Don't return to TabView if there are any app tabs
           for (let a = 0; a < gBrowser._numPinnedTabs; a++) {
@@ -820,19 +833,24 @@ let UI = {
   // Function: onTabSelect
   // Called when the user switches from one tab to another outside of the TabView UI.
   onTabSelect: function UI_onTabSelect(tab) {
     this._currentTab = tab;
 
     if (this.isTabViewVisible()) {
       // We want to zoom in if:
       // 1) we didn't just restore a tab via Ctrl+Shift+T
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+      // 2) the currently selected tab is the last created tab and has a tabItem
+      if (!this.restoredClosedTab &&
+#else
       // 2) we're not in the middle of switching from/to private browsing
       // 3) the currently selected tab is the last created tab and has a tabItem
       if (!this.restoredClosedTab && !this._privateBrowsing.transitionMode &&
+#endif
           this._lastOpenedTab == tab && tab._tabViewTabItem) {
         tab._tabViewTabItem.zoomIn(true);
         this._lastOpenedTab = null;
         return;
       }
       if (this._closedLastVisibleTab ||
           (this._closedSelectedTabInTabView && !this.closedLastTabInTabView) ||
           this.restoredClosedTab) {
@@ -1007,18 +1025,20 @@ let UI = {
     // to handle both upper and lower cases here.
     [
 #ifdef XP_UNIX
       "redo",
 #endif
 #ifdef XP_MACOSX
       "fullScreen",
 #endif
-      "closeWindow", "tabview", "undoCloseTab", "undoCloseWindow",
-      "privatebrowsing"
+      "closeWindow", "tabview", "undoCloseTab", "undoCloseWindow"
+#ifndef MOZ_PER_WINDOW_PRIVATE_BROWSING
+      , "privatebrowsing"
+#endif
     ].forEach(function(key) {
       let element = gWindow.document.getElementById("key_" + key);
       let code = element.getAttribute("key").toLocaleLowerCase().charCodeAt(0);
       keys[code] = key;
     });
     this._browserKeysWithShift = keys;
   },