Browse Source

Moved shutdown code from close() to onShutdown().

Note:
There was a lengthy discussion where the shutdown code should go,
according to the information we had initially, close() the right place,
but it turned out that it's not:
https://developer.thunderbird.net/add-ons/mailextensions/experiments#managing-your-experiments-lifecycle
1.1.101
Jorg Knobloch 2 years ago
parent
commit
c33b1d9ddc
1 changed files with 36 additions and 38 deletions
  1. +36
    -38
      addon/experiments.js

+ 36
- 38
addon/experiments.js View File

@ -110,8 +110,43 @@ var pEp4Tb = class extends ExtensionCommon.ExtensionAPI {
}
onShutdown(isAppShutdown) {
if (isAppShutdown) return;
console.info("pEp4Tb: onShutdown() called");
ExtensionSupport.unregisterWindowListener(EXTENSION_NAME);
for (let win of Services.wm.getEnumerator("mail:3pane")) {
unpaint(win);
}
for (let win of Services.wm.getEnumerator("msgcompose")) {
unpaint(win);
}
// Unload all modules.
Cu.unload("chrome://pEp4Tb/content/modules/handshake.js");
Cu.unload("chrome://pEp4Tb/content/modules/pEp.js");
Cu.unload("chrome://pEp4Tb/content/modules/pEpAdapter.js");
Cu.unload("chrome://pEp4Tb/content/modules/pEpServer.js");
Cu.unload("chrome://pEp4Tb/content/modules/utils.js");
Cu.unload("chrome://pEp4Tb/content/modules/xhrQueue.js");
Cu.unload("chrome://pEp4Tb/content/constants.js");
Cu.unload("chrome://pEp4Tb/content/detectAdapter.js");
Cu.unload("chrome://pEp4Tb/content/pEpController.js");
Cu.unload("chrome://pEp4Tb/content/pEpFactory.js");
Cu.unload("chrome://pEp4Tb/content/pEpForThunderbird.js");
Cu.unload("chrome://pEp4Tb/content/pEpLogger.js");
Cu.unload("chrome://pEp4Tb/content/pEpMimeDecrypt.js");
Cu.unload("chrome://pEp4Tb/content/pEpMimeEncrypt.js");
Cu.unload("chrome://pEp4Tb/content/TbContacts.js");
Cu.unload("chrome://pEp4Tb/content/TbHelper.js");
// Sync.
Cu.unload("chrome://pEp4Tb/content/sendMessage.js");
Cu.unload("chrome://pEp4Tb/content/syncWizard.js");
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.
@ -128,7 +163,6 @@ var pEp4Tb = class extends ExtensionCommon.ExtensionAPI {
getAPI(context) {
let { extension } = context;
context.callOnClose(this);
return {
pEp4Tb: {
addWindowListener() {
@ -187,42 +221,6 @@ var pEp4Tb = class extends ExtensionCommon.ExtensionAPI {
},
};
}
close() {
console.info("pEp4Tb: close() called");
ExtensionSupport.unregisterWindowListener(EXTENSION_NAME);
for (let win of Services.wm.getEnumerator("mail:3pane")) {
unpaint(win);
}
for (let win of Services.wm.getEnumerator("msgcompose")) {
unpaint(win);
}
// Unload all modules.
Cu.unload("chrome://pEp4Tb/content/modules/handshake.js");
Cu.unload("chrome://pEp4Tb/content/modules/pEp.js");
Cu.unload("chrome://pEp4Tb/content/modules/pEpAdapter.js");
Cu.unload("chrome://pEp4Tb/content/modules/pEpServer.js");
Cu.unload("chrome://pEp4Tb/content/modules/utils.js");
Cu.unload("chrome://pEp4Tb/content/modules/xhrQueue.js");
Cu.unload("chrome://pEp4Tb/content/constants.js");
Cu.unload("chrome://pEp4Tb/content/detectAdapter.js");
Cu.unload("chrome://pEp4Tb/content/pEpController.js");
Cu.unload("chrome://pEp4Tb/content/pEpFactory.js");
Cu.unload("chrome://pEp4Tb/content/pEpForThunderbird.js");
Cu.unload("chrome://pEp4Tb/content/pEpLogger.js");
Cu.unload("chrome://pEp4Tb/content/pEpMimeDecrypt.js");
Cu.unload("chrome://pEp4Tb/content/pEpMimeEncrypt.js");
Cu.unload("chrome://pEp4Tb/content/TbContacts.js");
Cu.unload("chrome://pEp4Tb/content/TbHelper.js");
// Sync.
Cu.unload("chrome://pEp4Tb/content/sendMessage.js");
Cu.unload("chrome://pEp4Tb/content/syncWizard.js");
Cu.unload("chrome://pEp4Tb/content/TbSync.js");
Cu.unload("chrome://pEp4Tb/content/modules/sync.js");
}
};
function paint(win) {


Loading…
Cancel
Save