Bug 1594000 - Convert remaining nsISimpleEnumerator users to use JS iteration in remaining parts. r=mkmelin
This commit is contained in:
Родитель
5474fb9a59
Коммит
0368a1c1e1
|
@ -153,12 +153,8 @@ var ExtensionSupport = {
|
|||
);
|
||||
zipReader.open(prefFile);
|
||||
let entries = zipReader.findEntries("defaults/preferences/*.js");
|
||||
let unsortedEntries = [];
|
||||
while (entries.hasMore()) {
|
||||
unsortedEntries.push(entries.getNext());
|
||||
}
|
||||
|
||||
for (let entryName of unsortedEntries.sort().reverse()) {
|
||||
for (let entryName of [...entries].sort().reverse()) {
|
||||
let stream = zipReader.getInputStream(entryName);
|
||||
let entrySize = zipReader.getEntry(entryName).realSize;
|
||||
if (entrySize > 0) {
|
||||
|
|
|
@ -38,8 +38,7 @@ function getCardForEmail(aEmailAddress) {
|
|||
// Email address is searched for in any of the address books that support
|
||||
// the cardForEmailAddress function.
|
||||
// Future expansion could be to domain matches
|
||||
let books = MailServices.ab.directories;
|
||||
for (let book of fixIterator(books, Ci.nsIAbDirectory)) {
|
||||
for (let book of MailServices.ab.directories) {
|
||||
try {
|
||||
let card = book.cardForEmailAddress(aEmailAddress);
|
||||
if (card) {
|
||||
|
|
|
@ -13,9 +13,6 @@ if (!customElements.get("menulist")) {
|
|||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
const { fixIterator } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
/**
|
||||
* MozMenulistAddrbooks is a menulist widget that is automatically
|
||||
* populated with the complete address book list.
|
||||
|
@ -131,7 +128,7 @@ if (!customElements.get("menulist")) {
|
|||
|
||||
if (this.getAttribute("mailinglists") == "true") {
|
||||
// Also append contained mailinglists.
|
||||
for (let list of fixIterator(ab.childNodes, Ci.nsIAbDirectory)) {
|
||||
for (let list of ab.childNodes) {
|
||||
if (this._matches(list)) {
|
||||
this._directories.push(list);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,6 @@ this.EXPORTED_SYMBOLS = [
|
|||
"augment_controller",
|
||||
];
|
||||
|
||||
var { fixIterator } = ChromeUtils.import(
|
||||
"resource:///modules/iteratorUtils.jsm"
|
||||
);
|
||||
var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
|
@ -244,10 +241,7 @@ var WindowWatcher = {
|
|||
// window type yet.
|
||||
// because this iterates from old to new, this does the right thing in that
|
||||
// side-effects of consider will pick the most recent window.
|
||||
for (let appWindow of fixIterator(
|
||||
Services.wm.getAppWindowEnumerator(null),
|
||||
Ci.nsIAppWindow
|
||||
)) {
|
||||
for (let appWindow of Services.wm.getAppWindowEnumerator(null)) {
|
||||
if (!this.consider(appWindow)) {
|
||||
this.monitoringList.push(appWindow);
|
||||
}
|
||||
|
|
|
@ -111,13 +111,7 @@ var tests = [
|
|||
];
|
||||
|
||||
function folderCount(folder) {
|
||||
let enumerator = folder.msgDatabase.EnumerateMessages();
|
||||
let count = 0;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
for (let hdr of fixIterator(enumerator, Ci.nsIMsgDBHdr)) {
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
return [...folder.msgDatabase.EnumerateMessages()].length;
|
||||
}
|
||||
|
||||
function setup() {
|
||||
|
@ -152,10 +146,9 @@ asyncUrlListener.callback = function(aUrl, aExitCode) {
|
|||
};
|
||||
|
||||
function listMessages(folder) {
|
||||
let enumerator = folder.msgDatabase.EnumerateMessages();
|
||||
var msgCount = 0;
|
||||
dump("listing messages for " + folder.prettyName + "\n");
|
||||
for (let hdr of fixIterator(enumerator, Ci.nsIMsgDBHdr)) {
|
||||
for (let hdr of folder.msgDatabase.EnumerateMessages()) {
|
||||
msgCount++;
|
||||
dump(msgCount + ": " + hdr.subject + "\n");
|
||||
}
|
||||
|
|
|
@ -59,30 +59,26 @@ var _folderEventLogHelper_msgFolderListener = {
|
|||
aJunkProcessed ? "junk processed" : "did not junk process",
|
||||
aTraitProcessed ? "trait processed" : "did not trait process",
|
||||
];
|
||||
for (let msgHdr of fixIterator(aMsgs, Ci.nsIMsgDBHdr)) {
|
||||
for (let msgHdr of aMsgs) {
|
||||
args.push(msgHdr);
|
||||
}
|
||||
mark_action("msgEvent", "msgsClassified", args);
|
||||
},
|
||||
|
||||
msgsDeleted(aMsgs) {
|
||||
let args = [];
|
||||
for (let msgHdr of fixIterator(aMsgs, Ci.nsIMsgDBHdr)) {
|
||||
args.push(msgHdr);
|
||||
}
|
||||
mark_action("msgEvent", "msgsDeleted", args);
|
||||
mark_action("msgEvent", "msgsDeleted", [...aMsgs]);
|
||||
},
|
||||
|
||||
msgsMoveCopyCompleted(aMove, aSrcMsgs, aDestFolder, aDestMsgs) {
|
||||
let args = [aMove ? "moved" : "copied"];
|
||||
for (let msgHdr of fixIterator(aSrcMsgs, Ci.nsIMsgDBHdr)) {
|
||||
for (let msgHdr of aSrcMsgs) {
|
||||
args.push(msgHdr);
|
||||
}
|
||||
args.push("to");
|
||||
args.push(aDestFolder);
|
||||
if (aDestMsgs) {
|
||||
args.push("dest headers:");
|
||||
for (let msgHdr of fixIterator(aDestMsgs, Ci.nsIMsgDBHdr)) {
|
||||
for (let msgHdr of aDestMsgs) {
|
||||
args.push(msgHdr);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче