Do not close container tabs in nightly - issue #241

This commit is contained in:
baku 2017-02-24 19:45:02 +01:00 committed by Jonathan Kingston
parent ad3c227150
commit 6874d64ce7

View file

@ -112,6 +112,7 @@ const ContextualIdentityProxy = {
const ContainerService = { const ContainerService = {
_identitiesState: {}, _identitiesState: {},
_windowMap: new Map(), _windowMap: new Map(),
_containerWasEnabled: false,
init(installation) { init(installation) {
// If we are just been installed, we must store some information for the // If we are just been installed, we must store some information for the
@ -159,6 +160,10 @@ const ContainerService = {
} }
} }
// Let's see if containers were enabled before this addon.
this._containerWasEnabled =
ss.storage.savedConfiguration.prefs["privacy.userContext.enabled"];
// Enabling preferences // Enabling preferences
PREFS.forEach((pref) => { PREFS.forEach((pref) => {
@ -1005,10 +1010,9 @@ const ContainerService = {
for (let window of windows.browserWindows) { // eslint-disable-line prefer-const for (let window of windows.browserWindows) { // eslint-disable-line prefer-const
// Let's close all the container tabs. // Let's close all the container tabs.
// Note 1: we don't care if containers are supported but the current FF // Note: We cannot use _closeTabs() because at this point tab.window is
// version.
// Note 2: We cannot use _closeTabs() because at this point tab.window is
// null. // null.
if (!this._containerWasEnabled) {
for (let tab of window.tabs) { // eslint-disable-line prefer-const for (let tab of window.tabs) { // eslint-disable-line prefer-const
if (this._getUserContextIdFromTab(tab)) { if (this._getUserContextIdFromTab(tab)) {
tab.close(); tab.close();
@ -1017,6 +1021,7 @@ const ContainerService = {
} catch(e) {} // eslint-disable-line no-empty } catch(e) {} // eslint-disable-line no-empty
} }
} }
}
this._getOrCreateContainerWindow(viewFor(window)).shutdown(); this._getOrCreateContainerWindow(viewFor(window)).shutdown();
} }