Browse Source

Reduce shutdown action to shutting down the controller. Ignore error from "close session" adapter call.

master
Jörg Knobloch 1 year ago
parent
commit
a249d64baf
2 changed files with 18 additions and 4 deletions
  1. +2
    -0
      addon/content/modules/pEpServer.js
  2. +16
    -4
      addon/experiments.js

+ 2
- 0
addon/content/modules/pEpServer.js View File

@ -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");


+ 16
- 4
addon/experiments.js View File

@ -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.


Loading…
Cancel
Save