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 = {
_identitiesState: {},
_windowMap: new Map(),
_containerWasEnabled: false,
init(installation) {
// 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
PREFS.forEach((pref) => {
@ -1005,16 +1010,16 @@ const ContainerService = {
for (let window of windows.browserWindows) { // eslint-disable-line prefer-const
// Let's close all the container tabs.
// Note 1: we don't care if containers are supported but the current FF
// version.
// Note 2: We cannot use _closeTabs() because at this point tab.window is
// null.
for (let tab of window.tabs) { // eslint-disable-line prefer-const
if (this._getUserContextIdFromTab(tab)) {
tab.close();
try {
SessionStore.forgetClosedTab(viewFor(window), 0);
} catch(e) {} // eslint-disable-line no-empty
// Note: We cannot use _closeTabs() because at this point tab.window is
// null.
if (!this._containerWasEnabled) {
for (let tab of window.tabs) { // eslint-disable-line prefer-const
if (this._getUserContextIdFromTab(tab)) {
tab.close();
try {
SessionStore.forgetClosedTab(viewFor(window), 0);
} catch(e) {} // eslint-disable-line no-empty
}
}
}