author | Ian Gilman <ian@iangilman.com> |
Wed, 03 Nov 2010 11:14:27 -0700 | |
changeset 60034 | 8bb78383bdb6b7c77cb3193c99dd9e3fab429889 |
parent 60033 | ccfc9d2147038b5422ddce218b03092028aabe0e |
child 60035 | f453924d5fe17898bff6ca1f103795ce5f718fce |
push id | 17837 |
push user | ian@iangilman.com |
push date | Wed, 05 Jan 2011 20:59:13 +0000 |
treeherder | mozilla-central@f453924d5fe1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | ehsan, dietrich |
bugs | 605935 |
milestone | 2.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
|
--- a/browser/base/content/tabview/ui.js +++ b/browser/base/content/tabview/ui.js @@ -95,21 +95,19 @@ let UI = { // 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, // Variable: _privateBrowsing // Keeps track of info related to private browsing, including: - // transitionStage - what step we're on in entering/exiting PB // transitionMode - whether we're entering or exiting PB // wasInTabView - whether TabView was visible before we went into PB _privateBrowsing: { - transitionStage: 0, transitionMode: "", wasInTabView: false }, // ---------- // Function: init // Must be called after the object is created. init: function UI_init() { @@ -520,75 +518,66 @@ let UI = { // session restore function srObserver(aSubject, aTopic, aData) { if (aTopic != "sessionstore-browser-state-restored") return; let hasGroupItemsData = GroupItems.load(); if (!hasGroupItemsData) self.reset(false); - - // if we're transitioning into/out of private browsing, update appropriately - if (self._privateBrowsing.transitionStage == 1) - self._privateBrowsing.transitionStage = 2; - 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"); }); // Private Browsing: - // We keep track of the transition to/from PB with the transitionStage - // and transitionMode properties of _privateBrowsing. The stage is 0 if - // not transitioning, 1 if just started ("change-granted"), 2 after the - // first sessionrestore, 3 after the "private-browsing" notification, and - // then back to 0 after the second sessionrestore. The mode is "" if not - // transitioning, otherwise it's "enter" or "exit" as appropriate. When - // transitioning to PB, we exit Panorama if necessary (making note of the + // 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(aSubject, aTopic, aData) { if (aTopic == "private-browsing") { - self._privateBrowsing.transitionStage = 3; + // We could probably do this in private-browsing-change-granted, but + // this seems like a nicer spot, right in the middle of the process. if (aData == "enter") { // If we are in Tab View, exit. 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(); } + } else if (aTopic == "private-browsing-transition-complete") { + // We use .transitionMode here, as aData is empty. + if (self._privateBrowsing.transitionMode == "exit" && + self._privateBrowsing.wasInTabView) + self.showTabView(false); + + self._privateBrowsing.transitionMode = ""; + TabItems.resumeReconnecting(); + GroupItems.resumeUpdatingTabBar(); } } Services.obs.addObserver(pbObserver, "private-browsing", false); 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"); }); // TabOpen this._eventListeners.open = function(tab) { if (tab.ownerDocument.defaultView != gWindow) return; // if it's an app tab, add it to all the group items @@ -607,17 +596,17 @@ let UI = { if (self.isTabViewVisible()) { // just closed the selected tab in the TabView interface. if (self._currentTab == tab) self._closedSelectedTabInTabView = true; } else { // If we're currently in the process of entering private browsing, // we don't want to go to the Tab View UI. - if (self._privateBrowsing.transitionStage > 0) + if (self._privateBrowsing.transitionMode) 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.tabs.length; a++) { let theTab = gBrowser.tabs[a]; if (theTab.pinned && gBrowser._removingTabs.indexOf(theTab) == -1)