diff --git a/addon/content/modules/pEpServer.js b/addon/content/modules/pEpServer.js index 28ca3bc..130c73f 100644 --- a/addon/content/modules/pEpServer.js +++ b/addon/content/modules/pEpServer.js @@ -75,6 +75,8 @@ class pEpServer { // are handled below. return response; }).catch((err) => { + // On Linux this is triggered with the "close session" call. Just ignore. + if (functionName == "close_session") return Promise.resolve(null); this.log.info("XMLHttpRequest failed first time. Maybe sleep/wake cycle. Retrying ..."); // This file is used in the test suite, hence calling this at the top doesn't work. let { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); diff --git a/addon/experiments.js b/addon/experiments.js index 95e004d..d1226b1 100644 --- a/addon/experiments.js +++ b/addon/experiments.js @@ -134,13 +134,27 @@ var pEp4Tb = class extends ExtensionCommon.ExtensionAPI { ExtensionSupport.unregisterWindowListener(EXTENSION_NAME); + let { pEpController } = ChromeUtils.import("chrome://pEp4Tb/content/pEpController.js"); + for (let win of Services.wm.getEnumerator("mail:3pane")) { - unpaint(win); + if (isAppShutdown) { + // Make sure the controller gets shut down. + pEpController.shutdown(); + } else { + unpaint(win); + } } for (let win of Services.wm.getEnumerator("msgcompose")) { - unpaint(win); + if (isAppShutdown) { + // Make sure the controller gets shut down. + pEpController.shutdown(); + } else { + unpaint(win); + } } + if (isAppShutdown) return; + // Unload all modules. Cu.unload("chrome://pEp4Tb/content/modules/handshake.js"); Cu.unload("chrome://pEp4Tb/content/modules/pEp.js"); @@ -166,8 +180,6 @@ var pEp4Tb = class extends ExtensionCommon.ExtensionAPI { Cu.unload("chrome://pEp4Tb/content/TbSync.js"); Cu.unload("chrome://pEp4Tb/content/modules/sync.js"); - if (isAppShutdown) return; - this.chromeHandle.destruct(); this.chromeHandle = null; // Looks like we got uninstalled. Maybe a new version will be installed now.