Bug 1801529 - use eslint-plugin-jsdoc in mailnews/test/. r=aleca
Differential Revision: https://phabricator.services.mozilla.com/D162500 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3cc46e8d92
Коммит
5901d59728
|
@ -1,5 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
extends: "plugin:mozilla/xpcshell-test",
|
||||
extends: ["plugin:mozilla/xpcshell-test", "plugin:mozilla/valid-jsdoc"],
|
||||
};
|
||||
|
|
|
@ -78,12 +78,12 @@ var localAccountUtils = {
|
|||
/**
|
||||
* Create an nsIMsgIncomingServer and an nsIMsgAccount to go with it.
|
||||
*
|
||||
* @param aType The type of the server (pop3, imap etc).
|
||||
* @param aPort The port the server is on.
|
||||
* @param aUsername The username for the server.
|
||||
* @param aPassword The password for the server.
|
||||
* @param aHostname The hostname for the server (defaults to localhost).
|
||||
* @return The newly-created nsIMsgIncomingServer.
|
||||
* @param {string} aType - The type of the server (pop3, imap etc).
|
||||
* @param {integer} aPort - The port the server is on.
|
||||
* @param {string} aUsername - The username for the server.
|
||||
* @param {string} aPassword - The password for the server.
|
||||
* @param {string} aHostname - The hostname for the server (defaults to localhost).
|
||||
* @returns {nsIMsgIncomingServer} The newly-created nsIMsgIncomingServer.
|
||||
*/
|
||||
create_incoming_server(
|
||||
aType,
|
||||
|
@ -106,14 +106,14 @@ var localAccountUtils = {
|
|||
* Create an nsIMsgIncomingServer and an nsIMsgAccount to go with it.
|
||||
* There are no identities created for the account.
|
||||
*
|
||||
* @param aType The type of the server (pop3, imap etc).
|
||||
* @param aPort The port the server is on.
|
||||
* @param aUsername The username for the server.
|
||||
* @param aPassword The password for the server.
|
||||
* @param aHostname The hostname for the server (defaults to localhost).
|
||||
* @return An object with the newly-created nsIMsgIncomingServer as the
|
||||
"server" property and the newly-created nsIMsgAccount as the
|
||||
"account" property.
|
||||
* @param {string} aType - The type of the server (pop3, imap etc).
|
||||
* @param {integer} aPort - The port the server is on.
|
||||
* @param {string} aUsername - The username for the server.
|
||||
* @param {string} aPassword - The password for the server.
|
||||
* @param {string} aHostname - The hostname for the server (defaults to localhost).
|
||||
* @returns {object} object
|
||||
* @returns {nsIMsgIncomingServer} object.server Created server
|
||||
* @returns {nsIMsgAccount} object.account Created account
|
||||
*/
|
||||
create_incoming_server_and_account(
|
||||
aType,
|
||||
|
@ -154,11 +154,11 @@ var localAccountUtils = {
|
|||
/**
|
||||
* Create an outgoing nsISmtpServer with the given parameters.
|
||||
*
|
||||
* @param aPort The port the server is on.
|
||||
* @param aUsername The username for the server
|
||||
* @param aPassword The password for the server
|
||||
* @param aHostname The hostname for the server (defaults to localhost).
|
||||
* @return The newly-created nsISmtpServer.
|
||||
* @param {integer} aPort - The port the server is on.
|
||||
* @param {string} aUsername - The username for the server
|
||||
* @param {string} aPassword - The password for the server
|
||||
* @param {string} [aHostname=localhost] - The hostname for the server.
|
||||
* @returns {nsISmtpServer} The newly-created nsISmtpServer.
|
||||
*/
|
||||
create_outgoing_server(aPort, aUsername, aPassword, aHostname = "localhost") {
|
||||
let server = MailServices.smtp.createServer();
|
||||
|
@ -173,10 +173,10 @@ var localAccountUtils = {
|
|||
* It does so by creating a new identity in the account using the given outgoing
|
||||
* server.
|
||||
*
|
||||
* @param {nsIMsgAccount} aIncoming The account to associate.
|
||||
* @param {nsISmtpServer} aOutgoingServer The outgoing server to associate.
|
||||
* @param {bool} aSetAsDefault Whether to set the outgoing server as the default for
|
||||
* the account.
|
||||
* @param {nsIMsgAccount} aIncoming - The account to associate.
|
||||
* @param {nsISmtpServer} aOutgoingServer - The outgoing server to associate.
|
||||
* @param {bool} aSetAsDefault Whether to set the outgoing server as the
|
||||
* default for the account.
|
||||
*/
|
||||
associate_servers(aIncoming, aOutgoingServer, aSetAsDefault = false) {
|
||||
if (!(aIncoming instanceof Ci.nsIMsgAccount)) {
|
||||
|
|
|
@ -147,8 +147,9 @@ var mailTestUtils = {
|
|||
* Returns the file system a particular file is on.
|
||||
* Currently supported on Windows only.
|
||||
*
|
||||
* @param aFile The file to get the file system for.
|
||||
* @return The file system a particular file is on, or 'null' if not on Windows.
|
||||
* @param {nsIFile} aFile - The file to get the file system for.
|
||||
* @returns {string} The file system a particular file is on, or 'null'
|
||||
* if not on Windows.
|
||||
*/
|
||||
get_file_system(aFile) {
|
||||
if (!("@mozilla.org/windows-registry-key;1" in Cc)) {
|
||||
|
@ -243,14 +244,15 @@ var mailTestUtils = {
|
|||
* - Linux: As long as you seek to a position before writing, happens automatically
|
||||
* on most file systems, so this function is a no-op.
|
||||
*
|
||||
* @param aFile The file to mark as sparse.
|
||||
* @param aRegionStart The start position of the sparse region, in bytes.
|
||||
* @param aRegionBytes The number of bytes to mark as sparse.
|
||||
* @return Whether the OS and file system supports marking files as sparse. If
|
||||
* this is true, then the file has been marked as sparse. If this is
|
||||
* false, then the underlying system doesn't support marking files as
|
||||
* sparse. If an exception is thrown, then the system does support
|
||||
* marking files as sparse, but an error occurred while doing so.
|
||||
* @param {nsIFile} aFile - The file to mark as sparse.
|
||||
* @param {integer} aRegionStart - The start position of the sparse region,
|
||||
* in bytes.
|
||||
* @param {integer} aRegionBytes - The number of bytes to mark as sparse.
|
||||
* @returns {boolean} Whether the OS and file system supports marking files as
|
||||
* sparse. If this is true, then the file has been marked as sparse.
|
||||
* If this isfalse, then the underlying system doesn't support marking files as
|
||||
* sparse. If an exception is thrown, then the system does support marking
|
||||
* files as sparse, but an error occurred while doing so.
|
||||
*
|
||||
*/
|
||||
mark_file_region_sparse(aFile, aRegionStart, aRegionBytes) {
|
||||
|
@ -454,8 +456,8 @@ var mailTestUtils = {
|
|||
* Converts a size in bytes into its mebibytes string representation.
|
||||
* NB: 1 MiB = 1024 * 1024 = 1048576 B.
|
||||
*
|
||||
* @param aSize The size in bytes.
|
||||
* @return A string representing the size in medibytes.
|
||||
* @param {integer} aSize - The size in bytes.
|
||||
* @returns {string} A string representing the size in mebibytes.
|
||||
*/
|
||||
toMiBString(aSize) {
|
||||
return aSize / 1048576 + " MiB";
|
||||
|
@ -466,10 +468,10 @@ var mailTestUtils = {
|
|||
* requiring you to pass a string to evaluate. If the function throws an
|
||||
* exception when invoked, we will use do_throw to ensure that the test fails.
|
||||
*
|
||||
* @param aDelayInMS The number of milliseconds to wait before firing the timer.
|
||||
* @param aFunc The function to invoke when the timer fires.
|
||||
* @param aFuncThis Optional 'this' pointer to use.
|
||||
* @param aFuncArgs Optional list of arguments to pass to the function.
|
||||
* @param {integer} aDelayInMS - The number of milliseconds to wait before firing the timer.
|
||||
* @param {Function} aFunc - The function to invoke when the timer fires.
|
||||
* @param {object} [aFuncThis] - Optional 'this' pointer to use.
|
||||
* @param {*[]} aFuncArgs - Optional list of arguments to pass to the function.
|
||||
*/
|
||||
_timer: null,
|
||||
do_timeout_function(aDelayInMS, aFunc, aFuncThis, aFuncArgs) {
|
||||
|
@ -495,25 +497,25 @@ var mailTestUtils = {
|
|||
* callback once the folder has been loaded. (This may be instantly or
|
||||
* after a re-parse.)
|
||||
*
|
||||
* @param aFolder The nsIMsgFolder whose database you want to ensure is
|
||||
* up-to-date.
|
||||
* @param aCallback The callback function to invoke once the folder has been
|
||||
* loaded.
|
||||
* @param aCallbackThis The 'this' to use when calling the callback. Pass null
|
||||
* if your callback does not rely on 'this'.
|
||||
* @param aCallbackArgs A list of arguments to pass to the callback via apply.
|
||||
* If you provide [1,2,3], we will effectively call:
|
||||
* aCallbackThis.aCallback(1,2,3);
|
||||
* @param [aSomeoneElseWillTriggerTheUpdate=false] If this is true, we do not
|
||||
* trigger the updateFolder call and it is assumed someone else is taking
|
||||
* care of that.
|
||||
* @param {nsIMsgFolder} aFolder - The nsIMsgFolder whose database you want
|
||||
* to ensure is up-to-date.
|
||||
* @param {Function} aCallback - The callback function to invoke once the
|
||||
* folder has been loaded.
|
||||
* @param {object} aCallbackThis - The 'this' to use when calling the callback.
|
||||
* Pass null if your callback does not rely on 'this'.
|
||||
* @param {*[]} aCallbackArgs - A list of arguments to pass to the callback
|
||||
* via apply. If you provide [1,2,3], we will effectively call:
|
||||
* aCallbackThis.aCallback(1,2,3);
|
||||
* @param {boolean} [aSomeoneElseWillTriggerTheUpdate=false] If this is true,
|
||||
* we do not trigger the updateFolder call and it is assumed someone else is
|
||||
* taking care of that.
|
||||
*/
|
||||
updateFolderAndNotify(
|
||||
aFolder,
|
||||
aCallback,
|
||||
aCallbackThis,
|
||||
aCallbackArgs,
|
||||
aSomeoneElseWillTriggerTheUpdate
|
||||
aSomeoneElseWillTriggerTheUpdate = false
|
||||
) {
|
||||
// register for the folder loaded notification ahead of time... even though
|
||||
// we may not need it...
|
||||
|
@ -554,12 +556,12 @@ var mailTestUtils = {
|
|||
* `EventUtils` as an argument because importing it here does not work
|
||||
* because `window` is not defined.
|
||||
*
|
||||
* @param {Object} EventUtils - The EventUtils object.
|
||||
* @param {object} EventUtils - The EventUtils object.
|
||||
* @param {Window} win - The window the tree is in.
|
||||
* @param {Element} tree - The tree element.
|
||||
* @param {number} row - The tree row to click on.
|
||||
* @param {number} column - The tree column to click on.
|
||||
* @param {Object} event - The mouse event to synthesize, e.g. `{ clickCount: 2 }`.
|
||||
* @param {object} event - The mouse event to synthesize, e.g. `{ clickCount: 2 }`.
|
||||
*/
|
||||
treeClick(EventUtils, win, tree, row, column, event) {
|
||||
let coords = tree.getCoordsForCellItem(row, tree.columns[column], "cell");
|
||||
|
@ -578,11 +580,11 @@ var mailTestUtils = {
|
|||
* `MutationObserver` as an argument because importing it here does not work
|
||||
* because `window` is not defined here.
|
||||
*
|
||||
* @param {Object} MutationObserver - The MutationObserver object.
|
||||
* @param {object} MutationObserver - The MutationObserver object.
|
||||
* @param {Document} doc - Document that contains the elements.
|
||||
* @param {string} observedNodeId - Id of the element to observe.
|
||||
* @param {string} awaitedNodeId - Id of the element that will soon exist.
|
||||
* @return {Promise.<undefined>} - A promise fulfilled when the element exists.
|
||||
* @returns {Promise.<undefined>} - A promise fulfilled when the element exists.
|
||||
*/
|
||||
awaitElementExistence(MutationObserver, doc, observedNodeId, awaitedNodeId) {
|
||||
return new Promise(resolve => {
|
||||
|
|
|
@ -412,9 +412,9 @@ var PKCS_SIGNATURE_MIME_TYPE = "application/x-pkcs7-signature";
|
|||
* up a gibberish signature. We wrap the provided parts in the standard
|
||||
* signature idiom
|
||||
*
|
||||
* @param aPart The content part to wrap. Only one part! Use a multipart if
|
||||
* you need to cram extra stuff in there.
|
||||
* @param aProperties Properties, propagated to SyntheticPart, see that.
|
||||
* @param {string} aPart - The content part to wrap. Only one part!
|
||||
* Use a multipart if you need to cram extra stuff in there.
|
||||
* @param {object} aProperties - Properties, propagated to SyntheticPart, see that.
|
||||
*/
|
||||
function SyntheticPartMultiSignedSMIME(aPart, aProperties) {
|
||||
SyntheticPartMulti.call(this, [aPart], aProperties);
|
||||
|
@ -443,9 +443,9 @@ var PGP_SIGNATURE_MIME_TYPE = "application/pgp-signature";
|
|||
* up a gibberish signature. We wrap the provided parts in the standard
|
||||
* signature idiom
|
||||
*
|
||||
* @param aPart The content part to wrap. Only one part! Use a multipart if
|
||||
* you need to cram extra stuff in there.
|
||||
* @param aProperties Properties, propagated to SyntheticPart, see that.
|
||||
* @param {string} aPart - The content part to wrap. Only one part!
|
||||
* Use a multipart if you need to cram extra stuff in there.
|
||||
* @param {object} aProperties - Properties, propagated to SyntheticPart, see that.
|
||||
*/
|
||||
function SyntheticPartMultiSignedPGP(aPart, aProperties) {
|
||||
SyntheticPartMulti.call(this, [aPart], aProperties);
|
||||
|
@ -477,15 +477,16 @@ var _DEFAULT_META_STATES = {
|
|||
* ingredients that went into the synthetic message as well as the rfc822 form
|
||||
* of the message.
|
||||
*
|
||||
* @param [aHeaders] A dictionary of rfc822 header payloads. The key should be
|
||||
* capitalized as you want it to appear in the output. This requires
|
||||
* adherence to convention of this class. You are best to just use the
|
||||
* helpers provided by this class.
|
||||
* @param [aBodyPart] An instance of one of the many Synthetic part types
|
||||
* available in this file.
|
||||
* @param [aMetaState] A dictionary of meta-state about the message that is only
|
||||
* relevant to the MessageInjection logic and perhaps some testing logic.
|
||||
* @param [aMetaState.junk=false] Is the method junk?
|
||||
* @param {object} [aHeaders] A dictionary of rfc822 header payloads.
|
||||
* The key should be capitalized as you want it to appear in the output.
|
||||
* This requires adherence to convention of this class. You are best to just
|
||||
* use the helpers provided by this class.
|
||||
* @param {object} [aBodyPart] - An instance of one of the many Synthetic part
|
||||
* types available in this file.
|
||||
* @param {object} [aMetaState] - A dictionary of meta-state about the message
|
||||
* that is only relevant to the MessageInjection logic and perhaps some
|
||||
* testing logic.
|
||||
* @param {boolean} [aMetaState.junk=false] Is the method junk?
|
||||
*/
|
||||
function SyntheticMessage(aHeaders, aBodyPart, aMetaState) {
|
||||
// we currently do not need to call SyntheticPart's constructor...
|
||||
|
@ -507,29 +508,29 @@ SyntheticMessage.prototype = {
|
|||
_format: null,
|
||||
_encoding: null,
|
||||
|
||||
/** @returns the Message-Id header value. */
|
||||
/** @returns {string} The Message-Id header value. */
|
||||
get messageId() {
|
||||
return this._messageId;
|
||||
},
|
||||
/**
|
||||
* Sets the Message-Id header value.
|
||||
*
|
||||
* @param aMessageId A unique string without the greater-than and less-than,
|
||||
* we add those for you.
|
||||
* @param {string} aMessageId - A unique string without the greater-than and
|
||||
* less-than, we add those for you.
|
||||
*/
|
||||
set messageId(aMessageId) {
|
||||
this._messageId = aMessageId;
|
||||
this.headers["Message-Id"] = "<" + aMessageId + ">";
|
||||
},
|
||||
|
||||
/** @returns the message Date header value. */
|
||||
/** @returns {Date} The message Date header value. */
|
||||
get date() {
|
||||
return this._date;
|
||||
},
|
||||
/**
|
||||
* Sets the Date header to the given javascript Date object.
|
||||
*
|
||||
* @param aDate The date you want the message to claim to be from.
|
||||
* @param {Date} aDate The date you want the message to claim to be from.
|
||||
*/
|
||||
set date(aDate) {
|
||||
this._date = aDate;
|
||||
|
@ -548,14 +549,14 @@ SyntheticMessage.prototype = {
|
|||
dateParts[5].substring(3);
|
||||
},
|
||||
|
||||
/** @returns the message subject */
|
||||
/** @returns {string} The message subject. */
|
||||
get subject() {
|
||||
return this._subject;
|
||||
},
|
||||
/**
|
||||
* Sets the message subject.
|
||||
*
|
||||
* @param aSubject A string sans newlines or other illegal characters.
|
||||
* @param {string} aSubject - A string sans newlines or other illegal characters.
|
||||
*/
|
||||
set subject(aSubject) {
|
||||
this._subject = aSubject;
|
||||
|
@ -566,9 +567,9 @@ SyntheticMessage.prototype = {
|
|||
* Given a tuple containing [a display name, an e-mail address], returns a
|
||||
* string suitable for use in a to/from/cc header line.
|
||||
*
|
||||
* @param aNameAndAddress A list with two elements. The first should be the
|
||||
* display name (sans wrapping quotes). The second element should be the
|
||||
* e-mail address (sans wrapping greater-than/less-than).
|
||||
* @param {string[]} aNameAndAddress - A list with two elements. The first
|
||||
* should be the display name (sans wrapping quotes). The second element
|
||||
* should be the e-mail address (sans wrapping greater-than/less-than).
|
||||
*/
|
||||
_formatMailFromNameAndAddress(aNameAndAddress) {
|
||||
// if the name is encoded, do not put it in quotes!
|
||||
|
@ -583,8 +584,9 @@ SyntheticMessage.prototype = {
|
|||
* can (per rfc 2822) be of two forms:
|
||||
* 1) Name <me@example.org>
|
||||
* 2) me@example.org
|
||||
* @return a tuple of name, email
|
||||
**/
|
||||
*
|
||||
* @returns {string[]} A tuple of name, email.
|
||||
*/
|
||||
_parseMailbox(mailbox) {
|
||||
let matcher = mailbox.match(/(.*)<(.+@.+)>/);
|
||||
if (!matcher) {
|
||||
|
@ -597,7 +599,7 @@ SyntheticMessage.prototype = {
|
|||
return [name, email];
|
||||
},
|
||||
|
||||
/** @returns the name-and-address tuple used when setting the From header. */
|
||||
/** @returns {string[]} The name-and-address tuple used when setting the From header. */
|
||||
get from() {
|
||||
return this._from;
|
||||
},
|
||||
|
@ -605,10 +607,10 @@ SyntheticMessage.prototype = {
|
|||
* Sets the From header using the given tuple containing [a display name,
|
||||
* an e-mail address].
|
||||
*
|
||||
* @param aNameAndAddress A list with two elements. The first should be the
|
||||
* display name (sans wrapping quotes). The second element should be the
|
||||
* e-mail address (sans wrapping greater-than/less-than).
|
||||
* Can also be a string, should then be a valid raw From: header value.
|
||||
* @param {string[]} aNameAndAddress - A list with two elements. The first
|
||||
* should be the display name (sans wrapping quotes). The second element
|
||||
* should be the e-mail address (sans wrapping greater-than/less-than).
|
||||
* Can also be a string, should then be a valid raw From: header value.
|
||||
*/
|
||||
set from(aNameAndAddress) {
|
||||
if (typeof aNameAndAddress === "string") {
|
||||
|
@ -620,11 +622,11 @@ SyntheticMessage.prototype = {
|
|||
this.headers.From = this._formatMailFromNameAndAddress(aNameAndAddress);
|
||||
},
|
||||
|
||||
/** @returns The display name part of the From header. */
|
||||
/** @returns {string} The display name part of the From header. */
|
||||
get fromName() {
|
||||
return this._from[0];
|
||||
},
|
||||
/** @returns The e-mail address part of the From header (no display name). */
|
||||
/** @returns {string} The e-mail address part of the From header (no display name). */
|
||||
get fromAddress() {
|
||||
return this._from[1];
|
||||
},
|
||||
|
@ -632,8 +634,8 @@ SyntheticMessage.prototype = {
|
|||
/**
|
||||
* For our header storage, we may need to pre-add commas, this does it.
|
||||
*
|
||||
* @param aList A list of strings that is mutated so that every string in the
|
||||
* list except the last one has a comma appended to it.
|
||||
* @param {string[]} aList - A list of strings that is mutated so that every
|
||||
* string in the list except the last one has a comma appended to it.
|
||||
*/
|
||||
_commaize(aList) {
|
||||
for (let i = 0; i < aList.length - 1; i++) {
|
||||
|
@ -643,8 +645,8 @@ SyntheticMessage.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* @returns the comma-ized list of name-and-address tuples used to set the To
|
||||
* header.
|
||||
* @returns {string[][]} the comma-ized list of name-and-address tuples used
|
||||
* to set the To header.
|
||||
*/
|
||||
get to() {
|
||||
return this._to;
|
||||
|
@ -653,11 +655,11 @@ SyntheticMessage.prototype = {
|
|||
* Sets the To header using a list of tuples containing [a display name,
|
||||
* an e-mail address].
|
||||
*
|
||||
* @param aNameAndAddress A list of name-and-address tuples. Each tuple is a
|
||||
* list with two elements. The first should be the
|
||||
* display name (sans wrapping quotes). The second element should be the
|
||||
* e-mail address (sans wrapping greater-than/less-than).
|
||||
* Can also be a string, should then be a valid raw To: header value.
|
||||
* @param {string[][]} aNameAndAddresses - A list of name-and-address tuples.
|
||||
* Each tuple is alist with two elements. The first should be the
|
||||
* display name (sans wrapping quotes). The second element should be the
|
||||
* e-mail address (sans wrapping greater-than/less-than).
|
||||
* Can also be a string, should then be a valid raw To: header value.
|
||||
*/
|
||||
set to(aNameAndAddresses) {
|
||||
if (typeof aNameAndAddresses === "string") {
|
||||
|
@ -677,18 +679,18 @@ SyntheticMessage.prototype = {
|
|||
)
|
||||
);
|
||||
},
|
||||
/** @returns The display name of the first intended recipient. */
|
||||
/** @returns {string} The display name of the first intended recipient. */
|
||||
get toName() {
|
||||
return this._to[0][0];
|
||||
},
|
||||
/** @returns The email address (no display name) of the first recipient. */
|
||||
/** @returns {string} The email address (no display name) of the first recipient. */
|
||||
get toAddress() {
|
||||
return this._to[0][1];
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns The comma-ized list of name-and-address tuples used to set the Cc
|
||||
* header.
|
||||
* @returns {string[][]} The comma-ized list of name-and-address tuples used
|
||||
* to set the Cc header.
|
||||
*/
|
||||
get cc() {
|
||||
return this._cc;
|
||||
|
@ -697,11 +699,11 @@ SyntheticMessage.prototype = {
|
|||
* Sets the Cc header using a list of tuples containing [a display name,
|
||||
* an e-mail address].
|
||||
*
|
||||
* @param aNameAndAddress A list of name-and-address tuples. Each tuple is a
|
||||
* list with two elements. The first should be the
|
||||
* display name (sans wrapping quotes). The second element should be the
|
||||
* e-mail address (sans wrapping greater-than/less-than).
|
||||
* Can also be a string, should then be a valid raw Cc: header value.
|
||||
* @param {string[][]} aNameAndAddresses - A list of name-and-address tuples.
|
||||
* Each tuple is a list with two elements. The first should be the
|
||||
* display name (sans wrapping quotes). The second element should be the
|
||||
* e-mail address (sans wrapping greater-than/less-than).
|
||||
* Can also be a string, should then be a valid raw Cc: header value.
|
||||
*/
|
||||
set cc(aNameAndAddresses) {
|
||||
if (typeof aNameAndAddresses === "string") {
|
||||
|
@ -733,8 +735,8 @@ SyntheticMessage.prototype = {
|
|||
* Normalizes header values, which may be strings or arrays of strings, into
|
||||
* a suitable string suitable for appending to the header name/key.
|
||||
*
|
||||
* @returns a normalized string representation of the header value(s), which
|
||||
* may include spanning multiple lines.
|
||||
* @returns {string} A normalized string representation of the header
|
||||
* value(s), which may include spanning multiple lines.
|
||||
*/
|
||||
_formatHeaderValues(aHeaderValues) {
|
||||
// may not be an array
|
||||
|
@ -749,8 +751,8 @@ SyntheticMessage.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* @returns a string uniquely identifying this message, at least as long as
|
||||
* the messageId is set and unique.
|
||||
* @returns {string} A string uniquely identifying this message, at least
|
||||
* as long as the messageId is set and unique.
|
||||
*/
|
||||
toString() {
|
||||
return "msg:" + this._messageId;
|
||||
|
@ -777,7 +779,7 @@ SyntheticMessage.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* @returns this messages in rfc822 format, or something close enough.
|
||||
* @returns {string} This messages in rfc822 format, or something close enough.
|
||||
*/
|
||||
toMessageString() {
|
||||
let lines = Object.keys(this.headers).map(
|
||||
|
@ -793,7 +795,7 @@ SyntheticMessage.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* @returns this message in rfc822 format in a string stream.
|
||||
* @returns {nsIStringInputStream} This message in rfc822 format in a string stream.
|
||||
*/
|
||||
toStream() {
|
||||
let stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
|
||||
|
@ -805,7 +807,7 @@ SyntheticMessage.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Writes this message to an mbox stream. This means adding a "From " line
|
||||
* Writes this message to an mbox stream. his means adding a "From " line
|
||||
* and making sure we've got a trailing newline.
|
||||
*/
|
||||
writeToMboxStream(aStream) {
|
||||
|
@ -817,8 +819,8 @@ SyntheticMessage.prototype = {
|
|||
/**
|
||||
* Write a list of messages to a folder
|
||||
*
|
||||
* @param aMessages The list of SyntheticMessages instances to write.
|
||||
* @param aFolder The folder to write to.
|
||||
* @param {SyntheticMessage[]} aMessages - The list of SyntheticMessages instances to write.
|
||||
* @param {nsIMsgFolder} aFolder - The folder to write to.
|
||||
*/
|
||||
function addMessagesToFolder(aMessages, aFolder) {
|
||||
let localFolder = aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
|
||||
|
@ -889,9 +891,9 @@ SyntheticMessageSet.prototype = {
|
|||
/**
|
||||
* Union this set with another set and return the (new) result.
|
||||
*
|
||||
* @param aOtherSet The other synthetic message set.
|
||||
* @returns a new SyntheticMessageSet containing the union of this set and
|
||||
* the other set.
|
||||
* @param {SyntheticMessageSet} aOtherSet - The other synthetic message set.
|
||||
* @returns {SyntheticMessageSet} A new SyntheticMessageSet containing the
|
||||
* union of this set and the other set.
|
||||
*/
|
||||
union(aOtherSet) {
|
||||
let messages = this.synMessages.concat(aOtherSet.synMessages);
|
||||
|
@ -923,7 +925,8 @@ SyntheticMessageSet.prototype = {
|
|||
/**
|
||||
* Get the single message header of the message at the given index; use
|
||||
* |msgHdrs| if you want to get all the headers at once.
|
||||
* @param {number} aIndex
|
||||
*
|
||||
* @param {integer} aIndex
|
||||
*/
|
||||
getMsgHdr(aIndex) {
|
||||
let folder = this.msgFolders[this.folderIndices[aIndex]];
|
||||
|
@ -933,7 +936,8 @@ SyntheticMessageSet.prototype = {
|
|||
|
||||
/**
|
||||
* Get the URI for the message at the given index.
|
||||
* @param {number} aIndex
|
||||
*
|
||||
* @param {integer} aIndex
|
||||
*/
|
||||
getMsgURI(aIndex) {
|
||||
let msgHdr = this.getMsgHdr(aIndex);
|
||||
|
@ -941,8 +945,8 @@ SyntheticMessageSet.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* @return a JS iterator of the message headers for all messages inserted into
|
||||
* a folder.
|
||||
* @yields {nsIMsgDBHdr} A JS iterator of the message headers for all
|
||||
* messages inserted into a folder.
|
||||
*/
|
||||
*msgHdrs() {
|
||||
// get the databases
|
||||
|
@ -955,16 +959,17 @@ SyntheticMessageSet.prototype = {
|
|||
}
|
||||
},
|
||||
/**
|
||||
* @return a JS list of the message headers for all messages inserted into a
|
||||
* folder.
|
||||
* @returns {nsIMsgDBHdr} A JS list of the message headers for all
|
||||
* messages inserted into a folder.
|
||||
*/
|
||||
get msgHdrList() {
|
||||
return Array.from(this.msgHdrs());
|
||||
},
|
||||
|
||||
/**
|
||||
* @return a list where each item is a list with two elements; the first is
|
||||
* an nsIMsgFolder, and the second is a list of all of the nsIMsgDBHdrs
|
||||
* for the synthetic messages in the set inserted into that folder.
|
||||
* @returns {object[]} - A list where each item is a list with two elements;
|
||||
* the first is an nsIMsgFolder, and the second is a list of all of the nsIMsgDBHdrs
|
||||
* for the synthetic messages in the set inserted into that folder.
|
||||
*/
|
||||
get foldersWithMsgHdrs() {
|
||||
let results = this.msgFolders.map(folder => [folder, []]);
|
||||
|
@ -982,9 +987,9 @@ SyntheticMessageSet.prototype = {
|
|||
/**
|
||||
* Sets the status of the messages to read/unread.
|
||||
*
|
||||
* @param aRead true/false to set messages as read/unread
|
||||
* @param aMsgHdr A message header to work on. If not specified,
|
||||
* mark all messages in the current set.
|
||||
* @param {boolean} aRead - true/false to set messages as read/unread
|
||||
* @param {nsIMsgDBHdr} aMsgHdr - A message header to work on. If not
|
||||
* specified, mark all messages in the current set.
|
||||
*/
|
||||
setRead(aRead, aMsgHdr) {
|
||||
let msgHdrs = aMsgHdr ? [aMsgHdr] : this.msgHdrList;
|
||||
|
@ -992,16 +997,31 @@ SyntheticMessageSet.prototype = {
|
|||
msgHdr.markRead(aRead);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Sets the starred status of the messages.
|
||||
*
|
||||
* @param {boolean} aStarred - Starred status.
|
||||
*/
|
||||
setStarred(aStarred) {
|
||||
for (let msgHdr of this.msgHdrs()) {
|
||||
msgHdr.markFlagged(aStarred);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Adds tag to the messages.
|
||||
*
|
||||
* @param {string} aTagName - Tag to add
|
||||
*/
|
||||
addTag(aTagName) {
|
||||
for (let [folder, msgHdrs] of this.foldersWithMsgHdrs) {
|
||||
folder.addKeywordsToMessages(msgHdrs, aTagName);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Removes tag from the messages.
|
||||
*
|
||||
* @param {string} aTagName - Tag to remove
|
||||
*/
|
||||
removeTag(aTagName) {
|
||||
for (let [folder, msgHdrs] of this.foldersWithMsgHdrs) {
|
||||
folder.removeKeywordsFromMessages(msgHdrs, aTagName);
|
||||
|
@ -1014,9 +1034,9 @@ SyntheticMessageSet.prototype = {
|
|||
* classifier. Which I'm conveniently not. Feel free to add a
|
||||
* "setJunkForRealsies" method if you are.)
|
||||
*
|
||||
* @param aIsJunk true/false to set messages to junk/non-junk
|
||||
* @param aMsgHdr A message header to work on. If not specified,
|
||||
* mark all messages in the current set.
|
||||
* @param {boolean} aIsJunk - true/false to set messages to junk/non-junk
|
||||
* @param {nsIMsgDBHdr} aMsgHdr - A message header to work on. If not
|
||||
* specified, mark all messages in the current set.
|
||||
* Generates a msgsJunkStatusChanged nsIMsgFolderListener notification.
|
||||
*/
|
||||
setJunk(aIsJunk, aMsgHdr) {
|
||||
|
@ -1079,9 +1099,9 @@ MessageGenerator.prototype = {
|
|||
* should be sufficient for testing purposes, but if your code cares, check
|
||||
* against MAX_VALID_NAMES.
|
||||
*
|
||||
* @param aNameNumber The 'number' of the name you want which must be less
|
||||
* @param {integer} aNameNumber The 'number' of the name you want which must be less
|
||||
* than MAX_VALID_NAMES.
|
||||
* @returns The unique name corresponding to the name number.
|
||||
* @returns {string} The unique name corresponding to the name number.
|
||||
*/
|
||||
makeName(aNameNumber) {
|
||||
let iFirst = aNameNumber % FIRST_NAMES.length;
|
||||
|
@ -1098,9 +1118,9 @@ MessageGenerator.prototype = {
|
|||
* up to 26*26 unique addresses can be generated, but if your code cares,
|
||||
* check against MAX_VALID_MAIL_ADDRESSES.
|
||||
*
|
||||
* @param aNameNumber The 'number' of the mail address you want which must be
|
||||
* less than MAX_VALID_MAIL_ADDRESSES.
|
||||
* @returns The unique name corresponding to the name mail address.
|
||||
* @param {integer} aNameNumber - The 'number' of the mail address you want
|
||||
* which must be ess than MAX_VALID_MAIL_ADDRESSES.
|
||||
* @returns {string} The unique name corresponding to the name mail address.
|
||||
*/
|
||||
makeMailAddress(aNameNumber) {
|
||||
let iFirst = aNameNumber % FIRST_NAMES.length;
|
||||
|
@ -1119,17 +1139,18 @@ MessageGenerator.prototype = {
|
|||
/**
|
||||
* Generate a pair of name and e-mail address.
|
||||
*
|
||||
* @param aNameNumber The optional 'number' of the name and mail address you
|
||||
* want. If you do not provide a value, we will increment an internal
|
||||
* counter to ensure that a new name is allocated and that will not be
|
||||
* re-used. If you use our automatic number once, you must use it always,
|
||||
* unless you don't mind or can ensure no collisions occur between our
|
||||
* number allocation and your uses. If provided, the number must be
|
||||
* less than MAX_VALID_NAMES.
|
||||
* @return A list containing two elements. The first is a name produced by
|
||||
* a call to makeName, and the second an e-mail address produced by a
|
||||
* call to makeMailAddress. This representation is used by the
|
||||
* SyntheticMessage class when dealing with names and addresses.
|
||||
* @param {integer} aNameNumber - The optional 'number' of the name and mail
|
||||
* address you want. If you do not provide a value, we will increment an
|
||||
* internal counter to ensure that a new name is allocated and that will not
|
||||
* be re-used. If you use our automatic number once, you must use it
|
||||
* always, unless you don't mind or can ensure no collisions occur between
|
||||
* our number allocation and your uses. If provided, the number must be
|
||||
* less than MAX_VALID_NAMES.
|
||||
* @returns {string[]} A list containing two elements.
|
||||
* The first is a name produced by a call to makeName, and the second an
|
||||
* e-mail address produced by a call to makeMailAddress.
|
||||
* This representation is used by the SyntheticMessage class when dealing
|
||||
* with names and addresses.
|
||||
*/
|
||||
makeNameAndAddress(aNameNumber) {
|
||||
if (aNameNumber === undefined) {
|
||||
|
@ -1144,8 +1165,8 @@ MessageGenerator.prototype = {
|
|||
* makeNameAndAddress. You should accordingly not allocate / hard code name
|
||||
* numbers on your own.
|
||||
*
|
||||
* @param aCount The number of people you want name and address tuples for.
|
||||
* @returns a list of aCount name-and-address tuples.
|
||||
* @param {integer} aCount - The number of people you want name and address tuples for.
|
||||
* @returns {string[][]} A list of aCount name-and-address tuples.
|
||||
*/
|
||||
makeNamesAndAddresses(aCount) {
|
||||
let namesAndAddresses = [];
|
||||
|
@ -1159,9 +1180,9 @@ MessageGenerator.prototype = {
|
|||
* Generate a consistently determined (and reversible) subject from a unique
|
||||
* value. Up to MAX_VALID_SUBJECTS can be produced.
|
||||
*
|
||||
* @param aSubjectNumber The subject number you want generated, must be less
|
||||
* than MAX_VALID_SUBJECTS.
|
||||
* @returns The subject corresponding to the given subject number.
|
||||
* @param {integer} aSubjectNumber - The subject number you want generated,
|
||||
* must be less than MAX_VALID_SUBJECTS.
|
||||
* @returns {string} The subject corresponding to the given subject number.
|
||||
*/
|
||||
makeSubject(aSubjectNumber) {
|
||||
if (aSubjectNumber === undefined) {
|
||||
|
@ -1192,9 +1213,10 @@ MessageGenerator.prototype = {
|
|||
* message id to the server that theoretically might be sending it. Or some
|
||||
* such.
|
||||
*
|
||||
* @param The synthetic message you would like us to make up a message-id for.
|
||||
* We don't set the message-id on the message, that's up to you.
|
||||
* @returns a Message-id suitable for the given message.
|
||||
* @param {SyntheticMessage} aSynthMessage - The synthetic message you would
|
||||
* like us to make up a message-id for. We don't set the message-id on the
|
||||
* message, that's up to you.
|
||||
* @returns {string} A Message-Id suitable for the given message.
|
||||
*/
|
||||
makeMessageId(aSynthMessage) {
|
||||
let msgId = this._nextMessageIdNum + "@made.up.invalid";
|
||||
|
@ -1209,7 +1231,7 @@ MessageGenerator.prototype = {
|
|||
* If you need a precise time ordering or precise times, make them up
|
||||
* yourself.
|
||||
*
|
||||
* @returns A made-up time in JavaScript Date object form.
|
||||
* @returns {Date} - A made-up time in JavaScript Date object form.
|
||||
*/
|
||||
makeDate() {
|
||||
let date = this._clock;
|
||||
|
@ -1225,7 +1247,7 @@ MessageGenerator.prototype = {
|
|||
* @property {number} [age] A dictionary with potential attributes 'minutes',
|
||||
* 'hours', 'days', 'weeks' to specify the message be created that far in
|
||||
* the past.
|
||||
* @property {Object} [attachments] A list of dictionaries suitable for passing to
|
||||
* @property {object} [attachments] A list of dictionaries suitable for passing to
|
||||
* syntheticPartLeaf, plus a 'body' attribute that has already been
|
||||
* encoded. Line chopping is on you FOR NOW.
|
||||
* @property {SyntheticPartLeaf} [body] A dictionary suitable for passing to SyntheticPart plus
|
||||
|
@ -1239,9 +1261,9 @@ MessageGenerator.prototype = {
|
|||
* attachments.)
|
||||
* @property {string} [callerData] A value to propagate to the callerData attribute
|
||||
* on the resulting message.
|
||||
* @property {[string, string][]} [cc] A list of cc recipients (name and address pairs). If
|
||||
* @property {string[][]} [cc] A list of cc recipients (name and address pairs). If
|
||||
* omitted, no cc is generated.
|
||||
* @property {[string, string]} [from] The name and value pair this message should be from.
|
||||
* @property {string[][]} [from] The name and value pair this message should be from.
|
||||
* Defaults to the first recipient if this is a reply, otherwise a new
|
||||
* person is synthesized via |makeNameAndAddress|.
|
||||
* @property {string} [inReplyTo] the SyntheticMessage this message should be in
|
||||
|
@ -1253,10 +1275,10 @@ MessageGenerator.prototype = {
|
|||
* cc.)
|
||||
* @property {string} [subject] subject to use; you are responsible for doing any
|
||||
* encoding before passing it in.
|
||||
* @property {[string, string][]} [to] The list of recipients for this message, defaults to a
|
||||
* @property {string[][]} [to] The list of recipients for this message, defaults to a
|
||||
* set of toCount newly created persons.
|
||||
* @property {number} [toCount=1] the number of people who the message should be to.
|
||||
* @property {Object} [clobberHeaders] An object whose contents will overwrite the
|
||||
* @property {object} [clobberHeaders] An object whose contents will overwrite the
|
||||
* contents of the headers object. This should only be used to construct
|
||||
* illegal header values; general usage should use another explicit
|
||||
* mechanism.
|
||||
|
@ -1398,7 +1420,7 @@ MessageGenerator.prototype = {
|
|||
* that sets the right content-type. Use like makeMessage.
|
||||
*
|
||||
* @param {MakeMessageOptions} aOptions
|
||||
* @return {SyntheticMessage}
|
||||
* @returns {SyntheticMessage}
|
||||
*/
|
||||
makeEncryptedSMimeMessage(aOptions) {
|
||||
if (!aOptions) {
|
||||
|
@ -1421,7 +1443,7 @@ MessageGenerator.prototype = {
|
|||
* that sets the right content-type. Use like makeMessage.
|
||||
*
|
||||
* @param {MakeMessageOptions} aOptions
|
||||
* @return {SyntheticMessage}
|
||||
* @returns {SyntheticMessage}
|
||||
*/
|
||||
makeEncryptedOpenPGPMessage(aOptions) {
|
||||
if (!aOptions) {
|
||||
|
@ -1462,10 +1484,12 @@ MessageGenerator.prototype = {
|
|||
* age: As used by makeMessage.
|
||||
* age_incr: Similar to age, but used to increment the values in the age
|
||||
* dictionary (assuming a value of zero if omitted).
|
||||
* @param [aSetDef.msgsPerThread=1] The number of messages per thread. If
|
||||
* you want to create direct-reply threads, you can pass a value for this
|
||||
* and have it not be one. If you need fancier reply situations,
|
||||
* directly use a scenario or hook us up to support that.
|
||||
*
|
||||
* @param {object} aSetDef - Message properties, see MAKE_MESSAGES_PROPAGATE.
|
||||
* @param {integer} [aSetDef.msgsPerThread=1] The number of messages per thread.
|
||||
* If you want to create direct-reply threads, you can pass a value for this
|
||||
* and have it not be one. If you need fancier reply situations,
|
||||
* directly use a scenario or hook us up to support that.
|
||||
*
|
||||
* Also supported are the following attributes as defined by makeMessage:
|
||||
* attachments, body, from, inReplyTo, subject, to, clobberHeaders, junk
|
||||
|
@ -1608,8 +1632,8 @@ MessageScenarioFactory.prototype = {
|
|||
* in question (never any part of its prototype chain). As such, you probably
|
||||
* want to invoke us on your prototype object(s).
|
||||
*
|
||||
* @param The object on whom we want to perform magic binding. This should
|
||||
* probably be your prototype object.
|
||||
* @param {object} aObj - The object on whom we want to perform magic binding.
|
||||
* This should probably be your prototype object.
|
||||
*/
|
||||
function bindMethods(aObj) {
|
||||
for (let [name, ubfunc] of Object.entries(aObj)) {
|
||||
|
|
|
@ -100,7 +100,7 @@ class MessageInjection {
|
|||
* IMAP:
|
||||
* Starts an IMAP Server for you
|
||||
*
|
||||
* @param {Object} injectionConfig
|
||||
* @param {object} injectionConfig
|
||||
* @param {"local"|"imap"} injectionConfig.mode mode One of "local", "imap".
|
||||
* @param {boolean} [injectionConfig.offline] Should the folder be marked offline (and
|
||||
* fully downloaded)? Only relevant for IMAP.
|
||||
|
@ -238,13 +238,13 @@ class MessageInjection {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {nsIMsgFolder}
|
||||
* @returns {nsIMsgFolder}
|
||||
*/
|
||||
getInboxFolder() {
|
||||
return this._mis.inboxFolder;
|
||||
}
|
||||
/**
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
messageInjectionIsLocal() {
|
||||
return this._mis.injectionConfig.mode == "local";
|
||||
|
@ -272,9 +272,10 @@ class MessageInjection {
|
|||
* Register a listener to be notified when interesting things happen involving
|
||||
* calls made to the message injection API.
|
||||
*
|
||||
* @param listener.onVirtualFolderCreated Called when a virtual folder is
|
||||
* created using |makeVirtualFolder|. The argument is the nsIMsgFolder
|
||||
* that defines the virtual folder.
|
||||
* @param {object} listener
|
||||
* @param {Function} listener.onVirtualFolderCreated Called when a virtual
|
||||
* folder is created using |makeVirtualFolder|. Takes a nsIMsgFolder
|
||||
* that defines the virtual folder as argument.
|
||||
*/
|
||||
registerMessageInjectionListener(listener) {
|
||||
this._mis.listeners.push(listener);
|
||||
|
@ -287,8 +288,8 @@ class MessageInjection {
|
|||
* @param {string} [folderName] A folder name with no support for hierarchy at this
|
||||
* time. A name of the form "gabba#" will be autogenerated if you do not
|
||||
* provide one.
|
||||
* @param {[nsMsgFolderFlags]} [specialFlags] A list of nsMsgFolderFlags bits to set.
|
||||
* @return {nsIMsgFolder|string} In local mode a nsIMsgFolder is returned.
|
||||
* @param {nsMsgFolderFlags[]} [specialFlags] A list of nsMsgFolderFlags bits to set.
|
||||
* @returns {nsIMsgFolder|string} In local mode a nsIMsgFolder is returned.
|
||||
* In imap mode a folder URI is returned.
|
||||
*/
|
||||
async makeEmptyFolder(folderName, specialFlags) {
|
||||
|
@ -391,7 +392,8 @@ class MessageInjection {
|
|||
*
|
||||
* Get/create the junk folder handle. Use getRealInjectionFolder if you
|
||||
* need the underlying nsIFolder.
|
||||
* @return {nsIMsgFolder}
|
||||
*
|
||||
* @returns {nsIMsgFolder}
|
||||
*/
|
||||
async getJunkFolder() {
|
||||
if (!this._mis.junkHandle) {
|
||||
|
@ -406,7 +408,7 @@ class MessageInjection {
|
|||
* Get/create the trash folder handle. Use getRealInjectionFolder if you
|
||||
* need the underlying nsIMsgFolder.
|
||||
*
|
||||
* @return {nsIMsgFolder|string}
|
||||
* @returns {nsIMsgFolder|string}
|
||||
*/
|
||||
async getTrashFolder() {
|
||||
if (!this._mis.trashHandle) {
|
||||
|
@ -442,7 +444,7 @@ class MessageInjection {
|
|||
* @param {boolean} [booleanAnd] Should the search terms be and-ed together.
|
||||
* Defaults to false.
|
||||
* @param {string} [folderName] Name to use.
|
||||
* @return {nsIMsgFolder|string} In local usage returns a nsIMsgFolder
|
||||
* @returns {nsIMsgFolder|string} In local usage returns a nsIMsgFolder
|
||||
* in imap usage returns a Folder URI.
|
||||
*/
|
||||
makeVirtualFolder(folders, searchDef, booleanAnd, folderName) {
|
||||
|
@ -516,10 +518,10 @@ class MessageInjection {
|
|||
* @param {number} folderCount
|
||||
* @param {MakeMessageOptions[]} synSetDefs A synthetic set
|
||||
* definition, as appropriate to pass to makeNewSetsInFolders.
|
||||
* @return {[nsIMsgFolder[], ...SyntheticMessageSet]} A Promise with a list whose
|
||||
* first element are the nsIMsgFolders created and
|
||||
* whose subsequent items are the SyntheticMessageSets used to populate the
|
||||
* folder (as returned by makeNewSetsInFolders).
|
||||
* @returns {Promise<object[]>} A Promise with a list whose first element are
|
||||
* the nsIMsgFolders created and whose subsequent items are the
|
||||
* SyntheticMessageSets used to populate the folder (as returned by
|
||||
* makeNewSetsInFolders). So nsIMsgFolder[], ...SyntheticMessageSet.
|
||||
*
|
||||
* Please note that the folders are either nsIMsgFolder, or folder
|
||||
* URIs, depending on whether we're in local injection mode, or on IMAP. This
|
||||
|
@ -552,7 +554,7 @@ class MessageInjection {
|
|||
* folders to ensure Thunderbird knows about the newly injected messages.
|
||||
* If you are testing Thunderbird's use of updateFolder itself, you will
|
||||
* not want this and so will want to pass true for this argument.
|
||||
* @return {SyntheticMessageSet[]} A Promise with a list of SyntheticMessageSet objects,
|
||||
* @returns {SyntheticMessageSet[]} A Promise with a list of SyntheticMessageSet objects,
|
||||
* each corresponding to the entry in synSetDefs (or implied if an integer was passed).
|
||||
*/
|
||||
async makeNewSetsInFolders(msgFolders, synSetDefs, doNotForceUpdate) {
|
||||
|
@ -775,7 +777,7 @@ class MessageInjection {
|
|||
* you with a result.
|
||||
*
|
||||
* @param {nsIMsgFolder|string} folderHandle nsIMsgFolder or folder URI.
|
||||
* @return {nsIMsgFolder}
|
||||
* @returns {nsIMsgFolder}
|
||||
*/
|
||||
getRealInjectionFolder(folderHandle) {
|
||||
if (this._mis.injectionConfig.mode == "imap") {
|
||||
|
|
|
@ -39,8 +39,8 @@ const STATE_WAIT_SOCKS5_REQUEST = 2;
|
|||
* This doesn't implement all of SOCKSv5, just enough to get a simple proxy
|
||||
* working for the test code.
|
||||
*
|
||||
* @param client_in The nsIInputStream of the socket.
|
||||
* @param client_out The nsIOutputStream of the socket.
|
||||
* @param {nsIInputStream} client_in - The nsIInputStream of the socket.
|
||||
* @param {nsIOutputStream} client_out - The nsIOutputStream of the socket.
|
||||
*/
|
||||
function SocksClient(client_in, client_out) {
|
||||
this.client_in = client_in;
|
||||
|
@ -230,9 +230,9 @@ var NetworkTestUtils = {
|
|||
* starting up a server, it does behoove you to call shutdownServers when you
|
||||
* no longer need to use the proxy server.
|
||||
*
|
||||
* @param hostName The DNS name to use for the client.
|
||||
* @param hostPort The port number to use for the client.
|
||||
* @param localRemappedPort The port number on which the real server sits.
|
||||
* @param {string} hostName - The DNS name to use for the client.
|
||||
* @param {integer} hostPort - The port number to use for the client.
|
||||
* @param {integer} localRemappedPort - The port number on which the real server sits.
|
||||
*/
|
||||
configureProxy(hostName, hostPort, localRemappedPort) {
|
||||
if (gSocksServer == null) {
|
||||
|
|
|
@ -56,8 +56,9 @@ PromiseTestUtils.PromiseUrlListener.prototype = {
|
|||
/**
|
||||
* Copy listener that can wrap another listener and trigger a callback.
|
||||
*
|
||||
* @param [aWrapped] The nsIMsgCopyServiceListener to pass all notifications through to.
|
||||
* This gets called prior to the callback (or async resumption).
|
||||
* @param {nsIMsgCopyServiceListener} [aWrapped] - The nsIMsgCopyServiceListener
|
||||
* to pass all notifications through to. This gets called prior to the
|
||||
* callback (or async resumption).
|
||||
*/
|
||||
PromiseTestUtils.PromiseCopyListener = function(aWrapped) {
|
||||
this.wrapped = aWrapped;
|
||||
|
@ -113,8 +114,9 @@ PromiseTestUtils.PromiseCopyListener.prototype = {
|
|||
/**
|
||||
* Stream listener that can wrap another listener and trigger a callback.
|
||||
*
|
||||
* @param [aWrapped] The nsIStreamListener to pass all notifications through to.
|
||||
* This gets called prior to the callback (or async resumption).
|
||||
* @param {nsIStreamListener} [aWrapped] - The nsIStreamListener to pass all
|
||||
* notifications through to. This gets called prior to the callback
|
||||
* (or async resumption).
|
||||
*/
|
||||
PromiseTestUtils.PromiseStreamListener = function(aWrapped) {
|
||||
this.wrapped = aWrapped;
|
||||
|
@ -169,10 +171,10 @@ PromiseTestUtils.PromiseStreamListener.prototype = {
|
|||
/**
|
||||
* Folder listener to resolve a promise when a certain folder event occurs.
|
||||
*
|
||||
* @param folder nsIMsgFolder to listen to
|
||||
* @param event string event name to listen for. Example event is
|
||||
* "DeleteOrMoveMsgCompleted".
|
||||
* @return promise that resolves when the event occurs
|
||||
* @param {nsIMsgFolder} folder - nsIMsgFolder to listen to
|
||||
* @param {string} event - Event name to listen for. Example event is
|
||||
* "DeleteOrMoveMsgCompleted".
|
||||
* @returns {Promise} Promise that resolves when the event occurs.
|
||||
*/
|
||||
PromiseTestUtils.promiseFolderEvent = function(folder, event) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -195,10 +197,10 @@ PromiseTestUtils.promiseFolderEvent = function(folder, event) {
|
|||
/**
|
||||
* Folder listener to resolve a promise when a certain folder event occurs.
|
||||
*
|
||||
* @param folder nsIMsgFolder to listen to
|
||||
* @param listenerMethod string listener method to listen for. Example listener
|
||||
method is "msgsClassified".
|
||||
* @return promise that resolves when the event occurs
|
||||
* @param {nsIMsgFolder} folder - nsIMsgFolder to listen to.
|
||||
* @param {string} listenerMethod - string listener method to listen for.
|
||||
* Example listener method is "msgsClassified".
|
||||
* @returns {Promise} Promise that resolves when the event occurs.
|
||||
*/
|
||||
PromiseTestUtils.promiseFolderNotification = function(folder, listenerMethod) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -233,11 +235,10 @@ PromiseTestUtils.promiseFolderNotification = function(folder, listenerMethod) {
|
|||
* Folder listener to resolve a promise when a folder with a certain
|
||||
* name is added.
|
||||
*
|
||||
* @param name folder name to listen for
|
||||
* @return promise{folder} that resolves with the new folder when the
|
||||
* folder add completes
|
||||
* @param {string} folderName - folder name to listen for
|
||||
* @returns {Promise<nsIMsgFolder>} Promise that resolves with the new folder
|
||||
* when the folder add completes.
|
||||
*/
|
||||
|
||||
PromiseTestUtils.promiseFolderAdded = function(folderName) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var listener = {
|
||||
|
@ -258,10 +259,9 @@ PromiseTestUtils.promiseFolderAdded = function(folderName) {
|
|||
/**
|
||||
* Timer to resolve a promise after a delay
|
||||
*
|
||||
* @param aDelay delay in milliseconds
|
||||
* @return promise that resolves after the delay
|
||||
* @param {integer} aDelay - Delay in milliseconds
|
||||
* @returns {Promise} Promise that resolves after the delay.
|
||||
*/
|
||||
|
||||
PromiseTestUtils.promiseDelay = function(aDelay) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
|
@ -272,11 +272,11 @@ PromiseTestUtils.promiseDelay = function(aDelay) {
|
|||
/**
|
||||
* Search listener to resolve a promise when a search completes
|
||||
*
|
||||
* @param [aSearchSession] The nsIMsgSearchSession to search
|
||||
* @param [aWrapped] The nsIMsgSearchNotify to pass all notifications through to.
|
||||
* This gets called prior to the callback (or async resumption).
|
||||
* @param {nsIMsgSearchSession} aSearchSession - The nsIMsgSearchSession to search
|
||||
* @param {nsIMsgSearchNotify} aWrapped - The nsIMsgSearchNotify to pass all
|
||||
* notifications through to. This gets called prior to the callback
|
||||
* (or async resumption).
|
||||
*/
|
||||
|
||||
PromiseTestUtils.PromiseSearchNotify = function(aSearchSession, aWrapped) {
|
||||
this._searchSession = aSearchSession;
|
||||
this._searchSession.registerListener(this);
|
||||
|
|
|
@ -46,8 +46,8 @@ var kNormalPropertiesURI =
|
|||
* This version is for JS/SQLite address books, if you create a new type,
|
||||
* replace this function to test them.
|
||||
*
|
||||
* @param {String} source Path to the source data, without extension
|
||||
* @param {String} dest Final file name in the profile, with extension
|
||||
* @param {string} source - Path to the source data, without extension
|
||||
* @param {string} dest - Final file name in the profile, with extension
|
||||
*/
|
||||
function loadABFile(source, dest) {
|
||||
let sourceFile = do_get_file(`${source}.sql`);
|
||||
|
|
|
@ -42,10 +42,10 @@ var ACTION_MAP = {
|
|||
/**
|
||||
* Creates a filter and appends it to the nsIMsgFilterList.
|
||||
*
|
||||
* @param list An nsIMsgFilter to which the new filter will be appended.
|
||||
* @param trigger A key of ATTRIB_MAP that represents the filter trigger.
|
||||
* @param value The value of the filter trigger.
|
||||
* @param action A key of ACTION_MAP that represents the action to be taken.
|
||||
* @param {nsIMsgFilter} list - An nsIMsgFilter to which the new filter will be appended.
|
||||
* @param {string} trigger - A key of ATTRIB_MAP that represents the filter trigger.
|
||||
* @param {string} value - The value of the filter trigger.
|
||||
* @param {nsMsgFilterAction} action - A key of ACTION_MAP that represents the action to be taken.
|
||||
*/
|
||||
function createFilter(list, trigger, value, action) {
|
||||
var filter = list.createFilter(trigger + action + "Test");
|
||||
|
|
|
@ -49,6 +49,7 @@ function registerFolderEventLogHelper() {
|
|||
/**
|
||||
* nsIMsgFolderListener implementation to logHelper events that gloda cares
|
||||
* about.
|
||||
*
|
||||
* @implements {nsIMsgFolderListener}
|
||||
*/
|
||||
var _folderEventLogHelper_msgFolderListener = {
|
||||
|
|
|
@ -222,14 +222,15 @@ function mark_test_end(aPopTo) {
|
|||
/**
|
||||
* For user test code and test support code to mark sub-regions of tests.
|
||||
*
|
||||
* @param aName The name of the (sub) test.
|
||||
* @param [aParameter=null] The parameter if the test is being parameterized.
|
||||
* @param [aNest=false] Should this nest inside other sub-tests? If you omit or
|
||||
* pass false, we will close out any existing sub-tests. If you pass true,
|
||||
* we nest inside the previous test/sub-test and rely on you to call
|
||||
* |mark_sub_test_end|. Sub tests can lost no longer than their parent.
|
||||
* You should strongly consider using the aNest parameter if you are
|
||||
* test support code.
|
||||
* @param {string} aName The name of the (sub) test.
|
||||
* @param {string} [aParameter=null] The parameter if the test is being parameterized.
|
||||
* @param {boolean} [aNest=false] Should this nest inside other sub-tests?
|
||||
* If you omit orpass false, we will close out any existing sub-tests.
|
||||
* If you pass true, we nest inside the previous test/sub-test and rely on
|
||||
* you to call |mark_sub_test_end|.
|
||||
* Sub tests can lost no longer than their parent.
|
||||
* You should strongly consider using the aNest parameter if you are test
|
||||
* support code.
|
||||
*/
|
||||
function mark_sub_test_start(aName, aParameter, aNest) {
|
||||
let depth = aNest ? _testLoggerContexts.length : 1;
|
||||
|
@ -290,9 +291,9 @@ function __value_copy(aObj, aDepthAllowed) {
|
|||
* Simple object copier to limit accidentally JSON-ing a ridiculously complex
|
||||
* object graph or getting tripped up by prototypes.
|
||||
*
|
||||
* @param aObj Input object.
|
||||
* @param aDepthAllowed How many times we are allowed to recursively call
|
||||
* ourselves.
|
||||
* @param {object} aObj - Input object.
|
||||
* @param {integer} aDepthAllowed - How many times we are allowed to recursively
|
||||
* call ourselves.
|
||||
*/
|
||||
function __simple_obj_copy(aObj, aDepthAllowed) {
|
||||
let oot = {};
|
||||
|
@ -551,12 +552,12 @@ _MarkAction.prototype = {
|
|||
* fails, but right now it means great fun for people who use logsploder and
|
||||
* just nicely formatted text for people looking at the console output.
|
||||
*
|
||||
* @param aWho Think of this like a logger handle... it might be soon.
|
||||
* @param aWhat What did you do?
|
||||
* @param aArgs A list of arguments, which could each be something like an
|
||||
* nsIMsgFolder or nsIMsgDBHdr or something like that. It uses
|
||||
* |_normalize_for_json| which can handle some native objects, be extended
|
||||
* to handle more, and does a fair job on straight JS objects.
|
||||
* @param {string} aWho - Think of this like a logger handle... it might be soon.
|
||||
* @param {string} aWhat - What did you do?
|
||||
* @param {*[]} aArgs A list of arguments, which could each be something like an
|
||||
* nsIMsgFolder or nsIMsgDBHdr or something like that. It uses
|
||||
* |_normalize_for_json| which can handle some native objects, be extended
|
||||
* to handle more, and does a fair job on straight JS objects.
|
||||
*/
|
||||
function mark_action(aWho, aWhat, aArgs) {
|
||||
let logger = console.createInstance({
|
||||
|
|
|
@ -10,7 +10,8 @@ if (typeof gDEPTH == "undefined") {
|
|||
|
||||
/**
|
||||
* Use the given storage database as the current signon database.
|
||||
* @returns Promise When the storage database is usable.
|
||||
*
|
||||
* @returns {Promise} Promive for when the storage database is usable.
|
||||
*/
|
||||
function setupForPassword(storageName) {
|
||||
let keyDB = do_get_file(gDEPTH + "mailnews/data/key4.db");
|
||||
|
|
|
@ -7,23 +7,22 @@
|
|||
/**
|
||||
* TestSearch: Class to test number of search hits
|
||||
*
|
||||
* @param aFolder: the folder to search
|
||||
* @param aValue: value used for the search
|
||||
* @param {nsIMsgFolder} aFolder - The folder to search
|
||||
* @param {string|integer} aValue - value used for the search
|
||||
* The interpretation of aValue depends on aAttrib. It
|
||||
* defaults to string, but for certain attributes other
|
||||
* types are used.
|
||||
* WARNING: not all attributes have been tested.
|
||||
*
|
||||
* @param aAttrib: attribute for the search (Ci.nsMsgSearchAttrib.Size, etc.)
|
||||
* @param aOp: operation for the search (Ci.nsMsgSearchOp.Contains, etc.)
|
||||
* @param aHitCount: expected number of search hits
|
||||
* @param onDone: function to call on completion of search
|
||||
* @param aCustomId: id string for the custom action, if aAttrib is Custom
|
||||
* @param aArbitraryHeader for OtherHeader case, header.
|
||||
* @param aHdrProperty for HdrProperty and Uint32HdrProperty case
|
||||
* @param {nsMsgSearchAttrib} aAttrib - Attribute for the search (Ci.nsMsgSearchAttrib.Size, etc.)
|
||||
* @param {nsMsgSearchOp} aOp - Operation for the search (Ci.nsMsgSearchOp.Contains, etc.)
|
||||
* @param {integer} aHitCount - Expected number of search hits
|
||||
* @param {Function} onDone - Function to call on completion of search
|
||||
* @param {string} aCustomId - Id string for the custom action, if aAttrib is Custom
|
||||
* @param {string} aArbitraryHeader - For OtherHeader case, header.
|
||||
* @param {string|integer} aHdrProperty - For HdrProperty and Uint32HdrProperty case
|
||||
*
|
||||
*/
|
||||
|
||||
function TestSearch(
|
||||
aFolder,
|
||||
aValue,
|
||||
|
|
Загрузка…
Ссылка в новой задаче