Bug 1518536 - remove most of iteratorUtils.jsm usage. r=benc

Differential Revision: https://phabricator.services.mozilla.com/D109083

--HG--
extra : rebase_source : 6baaec6ef5e4918ca1ff76b16b8ed8d8b034cce9
This commit is contained in:
Magnus Melin 2021-03-24 12:49:43 +02:00
Родитель 7bd4cc825e
Коммит 40f55a133b
45 изменённых файлов: 45 добавлений и 178 удалений

Просмотреть файл

@ -8,7 +8,6 @@
/* global MozElements, addMenuItem */
var { fixIterator } = ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
var { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
@ -56,7 +55,7 @@ function ltnInitMailIdentitiesRow(aCalendar) {
addMenuItem(menuPopup, cal.l10n.getLtnString("imipNoIdentity"), "none");
let identities;
if (aCalendar && aCalendar.aclEntry && aCalendar.aclEntry.hasAccessControl) {
identities = [...fixIterator(aCalendar.aclEntry.getOwnerIdentities(), Ci.nsIMsgIdentity)];
identities = aCalendar.aclEntry.getOwnerIdentities();
} else {
identities = MailServices.accounts.allIdentities;
}

Просмотреть файл

@ -17,9 +17,6 @@ var {
getMostRecentFolders,
folderNameCompare,
} = ChromeUtils.import("resource:///modules/folderUtils.jsm");
var { fixIterator, toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);

Просмотреть файл

@ -9,9 +9,6 @@ var { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
// Prefs
var PREF_TASKBAR_BRANCH = "mail.taskbar.lists.";
@ -156,10 +153,12 @@ var WinTaskbarJumpList = {
_buildTasks() {
if (this._tasks.length > 0) {
let items = toXPCOMArray(
this._tasks.map(task => this._createHandlerAppItem(task)),
Ci.nsIMutableArray
);
var items = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
for (let item of this._tasks.map(task =>
this._createHandlerAppItem(task)
)) {
items.appendElement(item);
}
this._builder.addListToBuild(
this._builder.JUMPLIST_CATEGORY_TASKS,
items

Просмотреть файл

@ -12,9 +12,6 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { VirtualFolderHelper } = ChromeUtils.import(
"resource:///modules/VirtualFolderWrapper.jsm"
);
var { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
// Only load these files if we're an XPCShell test. This file is also included by
// MozMill tests (mail/test/mozmill/shared-modules/test-folder-display-helpers.js).

Просмотреть файл

@ -34,7 +34,7 @@ var { MimeParser } = ChromeUtils.import("resource:///modules/mimeParser.jsm");
var { allAccountsSorted } = ChromeUtils.import(
"resource:///modules/folderUtils.jsm"
);
var { fixIterator, toArray } = ChromeUtils.import(
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailServices } = ChromeUtils.import(
@ -2438,7 +2438,7 @@ function attachToCloudNew(aAccount) {
return;
}
let files = Array.from(fixIterator(fp.files, Ci.nsIFile));
let files = [...fp.files];
let attachments = files.map(f => FileToAttachment(f));
let i = 0;
@ -5994,7 +5994,7 @@ function AttachFile() {
let file;
let attachments = [];
for (file of fixIterator(fp.files, Ci.nsIFile)) {
for (file of [...fp.files]) {
attachments.push(FileToAttachment(file));
}

Просмотреть файл

@ -10,6 +10,9 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { cloudFileAccounts } = ChromeUtils.import(
"resource:///modules/cloudFileAccounts.jsm"
);
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var kUploadNotificationValue = "bigAttachmentUploading";
var kPrivacyWarningNotificationValue = "bigAttachmentPrivacyWarning";

Просмотреть файл

@ -7,11 +7,6 @@ ChromeUtils.defineModuleGetter(
"MailServices",
"resource:///modules/MailServices.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"toXPCOMArray",
"resource:///modules/iteratorUtils.jsm"
);
this.accounts = class extends ExtensionAPI {
getAPI(context) {

Просмотреть файл

@ -8,11 +8,6 @@ ChromeUtils.defineModuleGetter(
"resource:///modules/MailServices.jsm"
);
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
ChromeUtils.defineModuleGetter(
this,
"toXPCOMArray",
"resource:///modules/iteratorUtils.jsm"
);
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["File", "FileReader"]);

Просмотреть файл

@ -7,16 +7,6 @@ ChromeUtils.defineModuleGetter(
"MailServices",
"resource:///modules/MailServices.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"fixIterator",
"resource:///modules/iteratorUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"toXPCOMArray",
"resource:///modules/iteratorUtils.jsm"
);
this.folders = class extends ExtensionAPI {
getAPI(context) {

Просмотреть файл

@ -20,7 +20,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AppConstants: "resource://gre/modules/AppConstants.jsm",
ExtensionContent: "resource://gre/modules/ExtensionContent.jsm",
MailServices: "resource:///modules/MailServices.jsm",
fixIterator: "resource:///modules/iteratorUtils.jsm",
});
XPCOMUtils.defineLazyPreferenceGetter(

Просмотреть файл

@ -22,11 +22,6 @@ ChromeUtils.defineModuleGetter(
"MsgHdrToMimeMessage",
"resource:///modules/gloda/MimeMessage.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"toXPCOMArray",
"resource:///modules/iteratorUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"NetUtil",

Просмотреть файл

@ -7,9 +7,6 @@
var { ExtensionTestUtils } = ChromeUtils.import(
"resource://testing-common/ExtensionXPCShellUtils.jsm"
);
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
add_task(async function setup() {
Services.prefs.setIntPref("ldap_2.servers.osx.dirType", -1);

Просмотреть файл

@ -11,9 +11,6 @@ var { Gloda } = ChromeUtils.import("resource:///modules/gloda/GlodaPublic.jsm");
var { GlodaIndexer } = ChromeUtils.import(
"resource:///modules/gloda/GlodaIndexer.jsm"
);
var { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
// Create some folders and populate them.
add_task(async function setup() {

Просмотреть файл

@ -7,7 +7,6 @@ module.exports = {
globals: {
AppConstants: true,
chatHandler: true,
fixIterator: true,
gChatTab: true,
Services: true,

Просмотреть файл

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { Services } = ChromeUtils.import("resource:///modules/imServices.jsm");
var addBuddy = {

Просмотреть файл

@ -6,12 +6,13 @@
/* import-globals-from ../../../../../toolkit/content/globalOverlay.js */
// This file is loaded in messenger.xhtml.
/* globals fixIterator, MailToolboxCustomizeDone, openIMAccountMgr,
PROTO_TREE_VIEW, Services, Status, statusSelector, ZoomManager */
/* globals MailToolboxCustomizeDone, openIMAccountMgr,
PROTO_TREE_VIEW, Status, statusSelector, ZoomManager */
var { Notifications } = ChromeUtils.import(
"resource:///modules/chatNotifications.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { Services: imServices } = ChromeUtils.import(
"resource:///modules/imServices.jsm"
);

Просмотреть файл

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { Services } = ChromeUtils.import("resource:///modules/imServices.jsm");
var autoJoinPref = "autoJoin";

Просмотреть файл

@ -17,9 +17,6 @@ var { be_in_folder, FAKE_SERVER_HOSTNAME } = ChromeUtils.import(
"resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
);
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);

Просмотреть файл

@ -30,10 +30,6 @@ var {
} = ChromeUtils.import(
"resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
);
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);

Просмотреть файл

@ -25,9 +25,6 @@ const { FileUtils } = ChromeUtils.import(
const { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
const { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
function waitForComposeWindow() {
return BrowserTestUtils.domWindowOpened(null, async win => {

Просмотреть файл

@ -12,9 +12,6 @@ var { MailServices } = ChromeUtils.import(
var { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
top.MAX_RECIPIENTS = 1;
var inputElementType = "";

Просмотреть файл

@ -5,10 +5,6 @@
/* import-globals-from dateFormat.js */
const { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var MILLISECONDS_PER_HOUR = 60 * 60 * 1000;
var MICROSECONDS_PER_DAY = 1000 * MILLISECONDS_PER_HOUR * 24;
@ -114,8 +110,8 @@ function markInDatabase(lower, upper) {
searchTerms.push(searchTerm);
}
let filterEnumerator = messageDatabase.getFilterEnumerator(searchTerms);
let headers = Array.from(fixIterator(filterEnumerator, Ci.nsIMsgDBHdr));
let msgEnumerator = messageDatabase.getFilterEnumerator(searchTerms);
let headers = [...msgEnumerator];
if (headers.length) {
messageFolder.markMessagesRead(headers, true);

Просмотреть файл

@ -2,9 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { PluralForm } = ChromeUtils.import(
"resource://gre/modules/PluralForm.jsm"

Просмотреть файл

@ -28,9 +28,6 @@ var { MailServices } = ChromeUtils.import(
var { VirtualFolderHelper } = ChromeUtils.import(
"resource:///modules/VirtualFolderWrapper.jsm"
);
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
document.addEventListener("dialogaccept", onOK);

Просмотреть файл

@ -35,9 +35,6 @@ var { XPCOMUtils } = ChromeUtils.import(
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
var { Gloda } = ChromeUtils.import("resource:///modules/gloda/Gloda.jsm");
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);

Просмотреть файл

@ -7,9 +7,6 @@
/* import-globals-from ../../content/retention.js */
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var gIncomingServer;
var gServerType;

Просмотреть файл

@ -6,9 +6,6 @@
/* import-globals-from am-prefs.js */
/* import-globals-from amUtils.js */
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");

Просмотреть файл

@ -10,9 +10,6 @@ var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
function BrowseForLocalFolders() {
const nsIFilePicker = Ci.nsIFilePicker;

Просмотреть файл

@ -12,9 +12,6 @@ var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var VirtualFolderHelper = {
/**
@ -135,16 +132,14 @@ VirtualFolderWrapper.prototype = {
/**
* Set the search folders that back this virtual folder.
*
* @param aFolders Either a "|"-delimited string of folder URIs or a list of
* nsIMsgFolders that fixIterator can traverse (JS array/nsIMutableArray).
* @param {string|nsIMsgFolder[]} - aFolders Either a "|"-delimited string of
* folder URIs or a list of folders
*/
set searchFolders(aFolders) {
if (typeof aFolders == "string") {
this.dbFolderInfo.setCharProperty("searchFolderUri", aFolders);
} else {
let uris = Array.from(fixIterator(aFolders, Ci.nsIMsgFolder)).map(
folder => folder.URI
);
let uris = aFolders.map(folder => folder.URI);
this.dbFolderInfo.setCharProperty("searchFolderUri", uris.join("|"));
}
},
@ -184,13 +179,12 @@ VirtualFolderWrapper.prototype = {
* a strinigified version of the search constraint, just set |searchString|
* directly.
*
* @param aTerms Some collection that fixIterator can traverse. A JS list or
* XPCOM array (nsIMutableArray) should work.
* @param {string[]} aTerms - a list of search terms
*/
set searchTerms(aTerms) {
let condition = "";
for (let term of aTerms) {
if (condition.length) {
if (condition) {
condition += " ";
}
if (term.matchAll) {

Просмотреть файл

@ -1,6 +1,3 @@
const { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MockRegistrar } = ChromeUtils.import(
"resource://testing-common/MockRegistrar.jsm"
);

Просмотреть файл

@ -29,10 +29,6 @@ const { GlodaQueryClassFactory } = ChromeUtils.import(
const { GlodaUtils } = ChromeUtils.import(
"resource:///modules/gloda/GlodaUtils.jsm"
);
const { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
const { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
@ -259,8 +255,7 @@ var Gloda = {
* in your listener's onQueryCompleted method; no results will be present in
* the collection when this method returns.)
*
* @param aHeaders A javascript Array or and XPCOM list that fixIterator can
* can handle.
* @param aHeaders An array of headers
* @param aListener The listener that should be registered with the collection
* @param aData The (optional) value to set as the data attribute on the
* collection.
@ -272,7 +267,7 @@ var Gloda = {
getMessageCollectionForHeaders(aHeaders, aListener, aData) {
// group the headers by the folder they are found in
let headersByFolder = {};
for (let header of fixIterator(aHeaders)) {
for (let header of aHeaders) {
let folderURI = header.folder.URI;
let headersForFolder = headersByFolder[folderURI];
if (headersForFolder === undefined) {

Просмотреть файл

@ -14,9 +14,6 @@
const EXPORTED_SYMBOLS = ["GlodaMsgIndexer"];
const { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
const { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
@ -38,6 +35,9 @@ const { GlodaIndexer, IndexingJob } = ChromeUtils.import(
const { MsgHdrToMimeMessage } = ChromeUtils.import(
"resource:///modules/gloda/MimeMessage.jsm"
);
const { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
// Cr does not have mailnews error codes!
var NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE = 0x80550005;
@ -1421,10 +1421,7 @@ var GlodaMsgIndexer = {
if (glodaFolder.dirtyStatus == glodaFolder.kFolderFilthy) {
this._indexerGetEnumerator(this.kEnumIndexedMsgs, true);
let count = 0;
for (let msgHdr of fixIterator(
this._indexingEnumerator,
Ci.nsIMsgDBHdr
)) {
for (let msgHdr of this._indexingEnumerator) {
// we still need to avoid locking up the UI, pause periodically...
if (++count % HEADER_CHECK_SYNC_BLOCK_SIZE == 0) {
yield this.kWorkSync;
@ -1462,7 +1459,7 @@ var GlodaMsgIndexer = {
let numMessagesToIndex = 0;
// eslint-disable-next-line no-unused-vars
for (let ignore of fixIterator(this._indexingEnumerator, Ci.nsIMsgDBHdr)) {
for (let ignore of this._indexingEnumerator) {
// We're only counting, so do bigger chunks on this pass.
++numMessagesToIndex;
if (numMessagesToIndex % (HEADER_CHECK_SYNC_BLOCK_SIZE * 8) == 0) {
@ -1478,10 +1475,7 @@ var GlodaMsgIndexer = {
// Pass 2: index the messages.
let count = 0;
for (let msgHdr of fixIterator(
this._indexingEnumerator,
Ci.nsIMsgDBHdr
)) {
for (let msgHdr of this._indexingEnumerator) {
// per above, we want to periodically release control while doing all
// this header traversal/investigation.
if (++count % HEADER_CHECK_SYNC_BLOCK_SIZE == 0) {

Просмотреть файл

@ -1,10 +1,6 @@
/* import-globals-from ../../../../test/resources/MessageGenerator.jsm */
load("../../../../resources/MessageGenerator.jsm");
const { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var gMessages = [];
const kSetCount = 13;
@ -86,15 +82,15 @@ function run_test() {
searchTerm.value = value;
searchTerms.push(searchTerm);
let filterEnumerator = inboxDB.getFilterEnumerator(searchTerms);
let matchingHdrs = Array.from(fixIterator(filterEnumerator, Ci.nsIMsgDBHdr));
let msgEnumerator = inboxDB.getFilterEnumerator(searchTerms);
let matchingHdrs = [...msgEnumerator];
Assert.equal(kNumExpectedMatches, matchingHdrs.length);
Assert.equal(matchingHdrs[0].messageId, gMessages[1].messageId);
Assert.equal(matchingHdrs[1].messageId, gMessages[3].messageId);
// try it backwards, with roller skates:
filterEnumerator = inboxDB.getFilterEnumerator(searchTerms, true);
matchingHdrs = Array.from(fixIterator(filterEnumerator, Ci.nsIMsgDBHdr));
msgEnumerator = inboxDB.getFilterEnumerator(searchTerms, true);
matchingHdrs = [...msgEnumerator];
Assert.equal(kNumExpectedMatches, matchingHdrs.length);
Assert.equal(matchingHdrs[0].messageId, gMessages[12].messageId);
Assert.equal(matchingHdrs[1].messageId, gMessages[11].messageId);

Просмотреть файл

@ -19,10 +19,6 @@ var gLastKey;
var gMessages = [];
var gCopyService = MailServices.copy;
var { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var tests = [
setup,
function* copyFolder1() {

Просмотреть файл

@ -11,9 +11,6 @@ load("../../../resources/MessageGenerator.jsm");
var gEmptyLocal1, gEmptyLocal2, gEmptyLocal3, gNotEmptyLocal4;
var { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);

Просмотреть файл

@ -14,9 +14,6 @@ load("../../../resources/logHelper.js");
load("../../../resources/asyncTestUtils.js");
load("../../../resources/POP3pump.js");
var { fixIterator, toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);

Просмотреть файл

@ -6,10 +6,6 @@
/* import-globals-from ../../../test/resources/MessageGenerator.jsm */
load("../../../resources/MessageGenerator.jsm");
var { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
/**
* Bug 66763
* Test deletion of a folder with a name already existing in Trash.

Просмотреть файл

@ -15,9 +15,6 @@ const { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
const log = console.createInstance({
prefix: "mail.periodicfilters",
@ -143,7 +140,7 @@ var PeriodicFilterManager = {
);
MailServices.filters.applyFiltersToFolders(
tempFilterList,
[...fixIterator(foldersToFilter, Ci.nsIMsgFolder)],
foldersToFilter,
null
);
}

Просмотреть файл

@ -13,9 +13,6 @@
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
var { fixIterator } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
function registerFolderEventLogHelper() {
// Bail if there's no one on the other end who cares about our very

Просмотреть файл

@ -19,9 +19,6 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
var { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var imapMessage;
try {

Просмотреть файл

@ -7,9 +7,6 @@
* for testing purposes.
*/
var { toXPCOMArray } = ChromeUtils.import(
"resource:///modules/iteratorUtils.jsm"
);
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
);
@ -213,12 +210,13 @@ SyntheticMessageSet.prototype = {
}
let str = aIsJunk ? "junk" : "notjunk";
MailServices.mfn.notifyItemEvent(
toXPCOMArray(msgHdrs, Ci.nsIMutableArray),
"JunkStatusChanged",
null,
str
let msgHdrsMA = Cc["@mozilla.org/array;1"].createInstance(
Ci.nsIMutableArray
);
for (let hdr of msgHdrs) {
msgHdrsMA.appendElement(hdr);
}
MailServices.mfn.notifyItemEvent(msgHdrsMA, "JunkStatusChanged", null, str);
},
/**

Просмотреть файл

@ -8,8 +8,7 @@
* Command-specific code. This stuff should be called by the widgets
*/
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {fixIterator} = ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.js");
//NOTE: gMessengerBundle and gBrandBundle must be defined and set

Просмотреть файл

@ -4,8 +4,6 @@
var { folderUtils } =
ChromeUtils.import("resource:///modules/folderUtils.jsm");
var { iteratorUtils } =
ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
var { Services } =
ChromeUtils.import("resource://gre/modules/Services.jsm");
@ -248,8 +246,7 @@ var gFolderTreeController = {
}
// Now delete the messages.
let messages = Array.from(fixIterator(folder.messages));
folder.deleteMessages(messages, msgWindow, true, false, null, false);
folder.deleteMessages([...folder.messages], msgWindow, true, false, null, false);
},
/**

Просмотреть файл

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const {PluralForm} = ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
const {fixIterator} = ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
var gSearchSession = null;
var gPreQuickSearchView = null;

Просмотреть файл

@ -4,8 +4,7 @@
var EXPORTED_SYMBOLS = ["MailUtils"];
const {fixIterator} = ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
/**
* This module has several utility functions for use by both core and