Browse Source

Fix some easy linting issues (low hanging fruit).

1.1.101
Jorg Knobloch 2 years ago
parent
commit
2a722ce394
7 changed files with 55 additions and 56 deletions
  1. +11
    -14
      .eslintrc.json
  2. +1
    -0
      chrome/content/modules/handshake.js
  3. +19
    -19
      chrome/content/modules/pEp.js
  4. +17
    -17
      chrome/content/modules/pEpAdapter.js
  5. +0
    -2
      chrome/content/modules/pEpFiles.js
  6. +3
    -3
      chrome/content/options.js
  7. +4
    -1
      chrome/content/pEpMimeDecrypt.js

+ 11
- 14
.eslintrc.json View File

@ -35,12 +35,20 @@
"quotes": [
"warn", "double"
],
"comment will leave the following": "off",
"camelcase": "off",
"max-classes-per-file": "off",
"new-cap": "off",
"no-bitwise": "off",
"no-console": "off",
"no-plusplus": "off",
"no-prototype-builtins": "off",
"no-underscore-dangle": "off",
"comment will need to look at all the following one-by-one": "off",
"array-callback-return": "off",
"block-scoped-var": "off",
"camelcase": "off",
"class-methods-use-this": "off",
"comma-dangle": "off",
"curly": "off",
"default-case": "off",
"eqeqeq": "off",
"func-names": "off",
@ -49,30 +57,19 @@
"guard-for-in": "off",
"implicit-arrow-linebreak": "off",
"indent": "off",
"lines-between-class-members": "off",
"max-classes-per-file": "off",
"max-len": "off",
"new-cap": "off",
"no-bitwise": "off",
"no-console": "off",
"no-empty": "off",
"no-empty-function": "off",
"no-fallthrough": "off",
"no-inner-declarations": "off",
"no-multi-spaces": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-prototype-builtins": "off",
"no-restricted-syntax": "off",
"no-return-assign": "off",
"no-return-await": "off",
"no-shadow": "off",
"no-underscore-dangle": "off",
"no-unreachable": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"no-use-before-define": "off",
"no-useless-constructor": "off",
"no-var": "off",
"nonblock-statement-body-position": "off",
"object-curly-spacing": "off",


+ 1
- 0
chrome/content/modules/handshake.js View File

@ -51,6 +51,7 @@ class Handshake {
.then((identitiesArray) => this.are_pEp_user(identitiesArray))
.then((this.getPrivacyColors).bind(this))
.then(this.sortByColor)
// eslint-disable-next-line no-return-assign
.then((identities) => this.allIdentities = identities)
.catch((err) => console.log(err));
}


+ 19
- 19
chrome/content/modules/pEp.js View File

@ -67,7 +67,7 @@ class pEp {
async getVersion() {
this.log.info("pEp: getVersion()");
return await this.adapter.serverVersion();
return this.adapter.serverVersion();
}
/**
@ -90,7 +90,7 @@ class pEp {
}
async emailRatings(email) {
return await this.identity_rating(email);
return this.identity_rating(email);
}
async getOutgoingRating(from, to = [], cc, bcc, preview = false) {
@ -108,20 +108,20 @@ class pEp {
message.setCc(bcc);
}
return await this.adapter.getOutgoingRating(message, preview);
return this.adapter.getOutgoingRating(message, preview);
}
async messageFromMIME(message) {
return await this.adapter.getMimeDecodeMessage(message, message.length);
return this.adapter.getMimeDecodeMessage(message, message.length);
}
async mimeFromMessage(message, omit_fields = false) {
return await this.adapter.getMimeEncodedMessage(message, omit_fields);
return this.adapter.getMimeEncodedMessage(message, omit_fields);
}
async decryptFromMIME(mimeMessage) {
const that = this;
return await this.messageFromMIME(mimeMessage).then((message) => that.decryptMailWithMessage(message)).catch((err) => this.log.error(err.message, err));
return this.messageFromMIME(mimeMessage).then((message) => that.decryptMailWithMessage(message)).catch((err) => this.log.error(err.message, err));
}
async myself(address, id, name, fingerprint) {
@ -129,12 +129,12 @@ class pEp {
const identity = new pEp.Identity(address, id, name, fingerprint);
// send to pEpAdapter
return await this.adapter.myself(identity);
return this.adapter.myself(identity);
}
async identity_rating(email, id, name, fp) {
const identity = new pEp.Identity(email, id, name, fp);
return await this.adapter.identity_rating(identity).then((rating) => {
return this.adapter.identity_rating(identity).then((rating) => {
identity.rating = rating;
return identity;
});
@ -146,7 +146,7 @@ class pEp {
const user1 = new pEp.Identity(identity1.address, identity1.user_id, identity1.username, identity1.fpr);
const user2 = new pEp.Identity(identity2.address, identity2.user_id, identity2.username, identity2.fpr);
// send to pEpAdapter
return await this.adapter.get_trustwords(user1, user2, language);
return this.adapter.get_trustwords(user1, user2, language);
}
async update_identity(address, id, name, fingerprint) {
@ -154,7 +154,7 @@ class pEp {
const identity = new pEp.Identity(address, id, name, fingerprint);
// send to pEpAdapter
return await this.adapter.update_identity(identity);
return this.adapter.update_identity(identity);
}
async key_reset_trust(address, id, name, fingerprint) {
@ -162,7 +162,7 @@ class pEp {
const identity = new pEp.Identity(address, id, name, fingerprint);
// send to pEpAdapter
return await this.adapter.key_reset_trust(identity);
return this.adapter.key_reset_trust(identity);
}
async key_reset_user(address, id, name, fingerprint) {
@ -170,7 +170,7 @@ class pEp {
const identity = new pEp.Identity(address, id, name, fingerprint);
// send to pEpAdapter
return await this.adapter.key_reset_user(identity);
return this.adapter.key_reset_user(identity);
}
async trust_personal_key(address, id, name, fingerprint) {
@ -178,7 +178,7 @@ class pEp {
const identity = new pEp.Identity(address, id, name, fingerprint);
// send to pEpAdapter
return await this.adapter.trust_personal_key(identity);
return this.adapter.trust_personal_key(identity);
}
async key_mistrusted(address, id, name, fingerprint) {
@ -186,7 +186,7 @@ class pEp {
const identity = new pEp.Identity(address, id, name, fingerprint);
// send to pEpAdapter
return await this.adapter.key_mistrusted(identity);
return this.adapter.key_mistrusted(identity);
}
async is_pEp_user(address, id, name, fingerprint) {
@ -194,7 +194,7 @@ class pEp {
const identity = new pEp.Identity(address, id, name, fingerprint);
// send to pEpAdapter
return await this.adapter.is_pEp_user(identity).then((is_pEp) => {
return this.adapter.is_pEp_user(identity).then((is_pEp) => {
identity.is_pEp = is_pEp;
return identity;
});
@ -204,28 +204,28 @@ class pEp {
this.log.info("pEp: enablePassiveMode()");
// send to pEpAdapter
return await this.adapter.passiveMode(true);
return this.adapter.passiveMode(true);
}
async disablePassiveMode() {
this.log.info("pEp: disablePassiveMode()");
// send to pEpAdapter
return await this.adapter.passiveMode(false);
return this.adapter.passiveMode(false);
}
async enableprotectSubjects() {
this.log.info("pEp: enableprotectSubjects()");
// send to pEpAdapter
return await this.adapter.protectSubjects(true);
return this.adapter.protectSubjects(true);
}
async disableprotectSubjects() {
this.log.info("pEp: disableprotectSubjects()");
// send to pEpAdapter
return await this.adapter.protectSubjects(false);
return this.adapter.protectSubjects(false);
}
}


+ 17
- 17
chrome/content/modules/pEpAdapter.js View File

@ -51,7 +51,7 @@ class pEpAdapter {
async serverVersion() {
this.log.info("pEpAdapter.js: serverVersion()");
const params = [];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_SERVER_VERSION,
params,
@ -64,7 +64,7 @@ class pEpAdapter {
async passiveMode(enable) {
this.log.info("pEpAdapter.js: passiveMode()");
const params = [enable];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_CONFIG_PASSIVE_MODE,
params,
@ -77,7 +77,7 @@ class pEpAdapter {
async protectSubjects(enable) {
this.log.info("pEpAdapter.js: passiveMode()");
const params = [!enable];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_CONFIG_UNENCRYPTED_SUBJECT,
params,
@ -90,7 +90,7 @@ class pEpAdapter {
async getOutgoingRating(message, preview) {
this.log.info("pEpAdapter.js: getOutgoingRating()");
const params = [message, "0"];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
preview ? API_METHOD_GET_OUTGOING_RATING_PREVIEW : API_METHOD_GET_OUTGOING_RATING,
params,
@ -103,7 +103,7 @@ class pEpAdapter {
async myself(identity) {
this.log.info("pEpAdapter.js: myself()", identity);
const params = [identity];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_GET_MYSELF,
params,
@ -116,7 +116,7 @@ class pEpAdapter {
async update_identity(identity) {
this.log.info("pEpAdapter.js: update_identity()", identity);
const params = [identity];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_GET_UPDATE_IDENTITY,
params,
@ -130,7 +130,7 @@ class pEpAdapter {
this.log.info("pEpAdapter.js: get_trustwords()", identity1, identity2);
const params = [identity1, identity2, language, "OUT", "OUT", full];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_GET_TRUSTWORDS,
params,
@ -145,7 +145,7 @@ class pEpAdapter {
async trust_personal_key(identity) {
this.log.info("pEpAdapter.js: trust_personal_key()", identity);
const params = [identity];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_GET_trust_personal_key,
params,
@ -159,7 +159,7 @@ class pEpAdapter {
async key_reset_trust(identity) {
this.log.info("pEpAdapter.js: key_reset_trust()", identity);
const params = [identity];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_GET_key_reset_trust,
params,
@ -172,7 +172,7 @@ class pEpAdapter {
async key_reset_user(identity) {
this.log.info("pEpAdapter.js: key_reset_user()", identity);
const params = [identity.user_id, identity.fpr];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_GET_key_reset_user,
params,
@ -185,7 +185,7 @@ class pEpAdapter {
async key_mistrusted(identity) {
this.log.info("pEpAdapter.js: key_mistrusted()", identity);
const params = [identity];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_GET_key_mistrusted,
params,
@ -198,7 +198,7 @@ class pEpAdapter {
async is_pEp_user(identity) {
this.log.info("pEpAdapter.js: is_pEp_user()", identity);
const params = [identity, true];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_GET_IS_PEP_USER,
params,
@ -211,7 +211,7 @@ class pEpAdapter {
async getMimeDecodeMessage(message, size) {
this.log.info("pEpAdapter.js: getMimeDecodeMessage()");
const params = [message, size, ["OP"]];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_MIME_DECODE_MESSAGE_METHOD,
params,
@ -227,7 +227,7 @@ class pEpAdapter {
async getMimeEncodedMessage(message, omit_fields) {
this.log.info("pEpAdapter.js: getMimeEncodedMessage()");
const params = [message, omit_fields, ["OP"]];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_MIME_ENCODE_MESSAGE_METHOD,
params,
@ -250,7 +250,7 @@ class pEpAdapter {
0, // flags output
];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_DECRYPT,
params,
@ -320,7 +320,7 @@ class pEpAdapter {
0, // Flags
];
this.log.info("pEpAdapter.js: encrypt_message()", message);
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_ENCRYPT,
params,
@ -396,7 +396,7 @@ class pEpAdapter {
}
const params = [identity, ["OP"]];
return await this.server.callPepAdapter(
return this.server.callPepAdapter(
SERVER_TYPE_CALL_FUNC,
API_METHOD_IDENTITY_RATING,
params,


+ 0
- 2
chrome/content/modules/pEpFiles.js View File

@ -3,8 +3,6 @@ const EXPORTED_SYMBOLS = ["pEpFiles"];
var {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
class pEpFiles {
constructor() {}
initPath(localFileObj, pathStr) {
localFileObj.initWithPath(pathStr);


+ 3
- 3
chrome/content/options.js View File

@ -18,15 +18,15 @@ Preferences.addAll([
]);
Preferences.get("extensions.pEp.protectSubjects").on(
"change",
protectSubjectsChange
protectSubjectsChange,
);
Preferences.get("extensions.pEp.passiveMode").on(
"change",
passiveModeChange
passiveModeChange,
);
Preferences.get("extensions.pEp.storeAllSecurely").on(
"change",
storeAllSecurelyChange
storeAllSecurelyChange,
);
function protectSubjectsChange() {


+ 4
- 1
chrome/content/pEpMimeDecrypt.js View File

@ -8,6 +8,7 @@ function makeComponent(controller) {
// we can just ignore the calls and return our decrypted data.
onStartRequest(request) {}
onDataAvailable(req, stream, offset, count) {}
onStopRequest(request, status) {
@ -15,8 +16,9 @@ function makeComponent(controller) {
if (decoded) {
let decoder = request.QueryInterface(Ci.nsIPgpMimeProxy);
// Workaround for ENGINE-727: end MIME text with CRLF.
if (decoded && !decoded.endsWith("\r\n"))
if (decoded && !decoded.endsWith("\r\n")) {
decoded += "\r\n";
}
decoder.outputDecryptedData(decoded, decoded.length);
} else {
console.log("this decryption component received no data from the view");
@ -36,6 +38,7 @@ function makeComponent(controller) {
const inspector = Cc["@mozilla.org/jsinspector;1"].createInstance(Ci.nsIJSInspector);
let synchronous;
const unlock = inspector.exitNestedEventLoop.bind(inspector);
// eslint-disable-next-line no-return-assign
const update = (asynchronous) => synchronous = asynchronous;
promise
.then(update)


Loading…
Cancel
Save