From e1f043f96f956c2097443054d0c22499b1bd11c6 Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Thu, 27 Apr 2017 20:33:40 +0200 Subject: [PATCH] Backed out changeset f349db3287ad (bug 1351808) for bustage on Android in GeckoApp.java. r=backout --- mobile/android/components/SessionStore.js | 25 ++++++++++------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/mobile/android/components/SessionStore.js b/mobile/android/components/SessionStore.js index 63d51697cbe2..63afada38d87 100644 --- a/mobile/android/components/SessionStore.js +++ b/mobile/android/components/SessionStore.js @@ -40,9 +40,6 @@ function log(a) { // Session Store // ----------------------------------------------------------------------- -const INVALID_TAB_ID = -1; -const INVALID_TAB_INDEX = -1; - const STATE_STOPPED = 0; const STATE_RUNNING = 1; const STATE_QUITTING = -1; @@ -85,7 +82,7 @@ SessionStore.prototype = { // The index where the most recently closed tab was in the tabs array // when it was closed. - _lastClosedTabIndex: INVALID_TAB_INDEX, + _lastClosedTabIndex: -1, // Whether or not to send notifications for changes to the closed tabs. _notifyClosedTabs: false, @@ -93,7 +90,7 @@ SessionStore.prototype = { // If we're simultaneously closing both a tab and Firefox, we don't want // to bother reloading the newly selected tab if it is zombified. // The Java UI will tell us which tab to watch out for. - _keepAsZombieTabId: INVALID_TAB_ID, + _keepAsZombieTabId: -1, init: function ss_init() { loggingEnabled = Services.prefs.getBoolPref("browser.sessionstore.debug_logging"); @@ -160,7 +157,7 @@ SessionStore.prototype = { win.closedTabs = []; } - this._lastClosedTabIndex = INVALID_TAB_INDEX; + this._lastClosedTabIndex = -1; }, onEvent: function ss_onEvent(event, data, callback) { @@ -417,7 +414,7 @@ SessionStore.prototype = { for (let window of Object.values(this._windows)) { window.closedTabs = window.closedTabs.filter(tab => !tab.isPrivate); } - this._lastClosedTabIndex = INVALID_TAB_INDEX; + this._lastClosedTabIndex = -1; break; } }, @@ -681,7 +678,7 @@ SessionStore.prototype = { onTabClose: function ss_onTabClose(aWindow, aBrowser, aTabIndex) { let data = aBrowser.__SS_data || {}; if (this._maxTabsUndo == 0 || this._sessionDataIsEmpty(data)) { - this._lastClosedTabIndex = INVALID_TAB_INDEX; + this._lastClosedTabIndex = -1; return; } @@ -808,7 +805,7 @@ SessionStore.prototype = { log("keeping as zombie tab " + tabId); } // The tab id passed through Tab:KeepZombified is valid for one TabSelect only. - this._keepAsZombieTabId = INVALID_TAB_ID; + this._keepAsZombieTabId = -1; log("onTabSelect() ran for tab " + tabId); this.saveStateDelayed(); @@ -843,7 +840,7 @@ SessionStore.prototype = { // The long press that initiated the move canceled any close undo option that may have been // present. - this._lastClosedTabIndex = INVALID_TAB_INDEX; + this._lastClosedTabIndex = -1; this.saveStateDelayed(); }, @@ -1410,7 +1407,7 @@ SessionStore.prototype = { } let parentId = tabData.parentId; - if (parentId > INVALID_TAB_ID) { + if (parentId > -1) { tab.parentId = parentId; } @@ -1490,7 +1487,7 @@ SessionStore.prototype = { tab.browser.__SS_extdata = aCloseTabData.extData; this._restoreTab(aCloseTabData, tab.browser); - this._lastClosedTabIndex = INVALID_TAB_INDEX; + this._lastClosedTabIndex = -1; if (this._notifyClosedTabs) { this._sendClosedTabsToJava(aWindow); @@ -1517,7 +1514,7 @@ SessionStore.prototype = { // Forget the last closed tab index if we're forgetting the last closed tab. if (aIndex == 0) { - this._lastClosedTabIndex = INVALID_TAB_INDEX; + this._lastClosedTabIndex = -1; } if (this._notifyClosedTabs) { this._sendClosedTabsToJava(aWindow); @@ -1525,7 +1522,7 @@ SessionStore.prototype = { }, get canUndoLastCloseTab() { - return this._lastClosedTabIndex > INVALID_TAB_INDEX; + return this._lastClosedTabIndex > -1; }, _sendClosedTabsToJava: function ss_sendClosedTabsToJava(aWindow) {