Merge branch 'bakulf-disable'

This commit is contained in:
Jonathan Kingston 2017-02-27 21:49:32 +00:00
commit 4e0907161f

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,16 +1010,16 @@ 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. // null.
// Note 2: We cannot use _closeTabs() because at this point tab.window is if (!this._containerWasEnabled) {
// null. 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(); try {
try { SessionStore.forgetClosedTab(viewFor(window), 0);
SessionStore.forgetClosedTab(viewFor(window), 0); } catch(e) {} // eslint-disable-line no-empty
} catch(e) {} // eslint-disable-line no-empty }
} }
} }