Browse Source

Minor tweaks to modules to get tests going again.

1.1.101
Jorg Knobloch 1 year ago
parent
commit
5aca1765a7
2 changed files with 6 additions and 11 deletions
  1. +2
    -9
      addon/content/modules/pEp.js
  2. +4
    -2
      addon/content/modules/pEpServer.js

+ 2
- 9
addon/content/modules/pEp.js View File

@ -14,8 +14,6 @@
* along with pp For Thunderbird. If not, see <https://www.gnu.org/licenses/>.
*/
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const EXPORTED_SYMBOLS = ["pEp"];
const DIR_INCOMING = 0;
@ -26,13 +24,6 @@ const ENC_FORMAT_PEP = 4;
const PEP_PREFIX = "pEp-";
// Added for the tests where btoa is not defined
// eslint-disable-next-line block-scoped-var
if (typeof btoa === "undefined" && typeof require === "function") {
// eslint-disable-next-line global-require, vars-on-top
var btoa = require("btoa");
}
class pEp {
constructor(logger, adapter) {
if (pEp.exists) return pEp.instance;
@ -158,6 +149,8 @@ class pEp {
async get_trustwords(identity1, identity2, language, full = false) {
if (!language) {
// 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");
language = Services.locale.appLocaleAsLangTag.replace(/-.*/, "");
if (!this.languageList.has(language)) language = "en";
}


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

@ -1,7 +1,5 @@
// This file is under GNU General Public License 3.0
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const EXPORTED_SYMBOLS = ["pEpServer"];
let pepServerInstance;
@ -78,6 +76,8 @@ class pEpServer {
return response;
}).catch((err) => {
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");
let win = Services.wm.getMostRecentWindow("mail:3pane");
if (win) {
return this.retry(win, funcType, functionName, paramsArr);
@ -97,6 +97,8 @@ class pEpServer {
return;
}
this.log.error("XMLHttpRequest failed", err2.message);
// 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");
Services.prompt.alert(
null,
win.pEp.pEpHdrView.getLocaleMessage("alertTitle"),


Loading…
Cancel
Save