--- a/calendar/base/modules/utils/calEmailUtils.jsm
+++ b/calendar/base/modules/utils/calEmailUtils.jsm
@@ -48,19 +48,17 @@ var calemail = {
/**
* Iterates all email identities and calls the passed function with identity and account.
* If the called function returns false, iteration is stopped.
*
* @param {Function} aFunc The function to be called for each identity and account
*/
iterateIdentities(aFunc) {
- let accounts = MailServices.accounts.accounts;
- for (let i = 0; i < accounts.length; ++i) {
- let account = accounts.queryElementAt(i, Ci.nsIMsgAccount);
+ for (let account of MailServices.accounts.accounts) {
let identities = account.identities;
for (let j = 0; j < identities.length; ++j) {
let identity = identities.queryElementAt(j, Ci.nsIMsgIdentity);
if (!aFunc(identity, account)) {
break;
}
}
}