Bug 1340947 - Part 2: Use for-of when iterating over fixIterator in mail/. r=jorgk

--HG--
extra : rebase_source : 921b3e605b51d957e4a9830df9069fd2fea93570
This commit is contained in:
Tooru Fujisawa 2017-02-20 12:58:22 +09:00
Родитель e7686be172
Коммит 90d9557cc3
8 изменённых файлов: 24 добавлений и 24 удалений

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

@ -849,7 +849,7 @@ function getServerThatCanHaveFilters()
// If it cannot, check all accounts to find a server
// that can have filters.
let allServers = MailServices.accounts.allServers;
for (let currentServer in fixIterator(allServers,
for (let currentServer of fixIterator(allServers,
Components.interfaces.nsIMsgIncomingServer))
{
if (currentServer.canHaveFilters)

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

@ -146,7 +146,7 @@ var editContactInlineUI = {
!list.isMailList)
continue;
for (let card in fixIterator(list.addressLists)) {
for (let card of fixIterator(list.addressLists)) {
if (card instanceof Components.interfaces.nsIAbCard &&
card.primaryEmail == this._cardDetails.card.primaryEmail) {
inMailList = true;

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

@ -2163,7 +2163,7 @@ FolderDisplayWidget.prototype = {
const nsIMsgIdentity = Components.interfaces.nsIMsgIdentity;
let allEnabled = undefined;
for (let identity in fixIterator(serverIdentities, nsIMsgIdentity)) {
for (let identity of fixIterator(serverIdentities, nsIMsgIdentity)) {
if (allEnabled === undefined) {
allEnabled = identity.archiveEnabled;
}

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

@ -1109,7 +1109,7 @@ var gFolderTreeView = {
_subFoldersWithStringProperty: function ftv_subFoldersWithStringProperty(folder, folders, aFolderName, deep)
{
for (let child in fixIterator(folder.subFolders, Components.interfaces.nsIMsgFolder)) {
for (let child of fixIterator(folder.subFolders, Components.interfaces.nsIMsgFolder)) {
// if the folder selection is based on a string propery, use that
if (aFolderName == getSmartFolderName(child)) {
folders.push(child);
@ -1139,7 +1139,7 @@ var gFolderTreeView = {
for (let acct of accounts) {
let foldersWithFlag = acct.incomingServer.rootFolder.getFoldersWithFlags(aFolderFlag);
if (foldersWithFlag.length > 0) {
for (let folderWithFlag in fixIterator(foldersWithFlag,
for (let folderWithFlag of fixIterator(foldersWithFlag,
Components.interfaces.nsIMsgFolder)) {
folders.push(folderWithFlag);
// Add sub-folders of Sent and Archive to the result.
@ -2011,7 +2011,7 @@ var gFolderTreeView = {
const Ci = Components.interfaces;
let folders = [];
for (let server in fixIterator(MailServices.accounts.allServers, Ci.nsIMsgIncomingServer)) {
for (let server of fixIterator(MailServices.accounts.allServers, Ci.nsIMsgIncomingServer)) {
// Skip deferred accounts
if (server instanceof Ci.nsIPop3IncomingServer &&
server.deferredToAccount)
@ -2032,7 +2032,7 @@ var gFolderTreeView = {
* @param folders the array to add the folders to.
*/
addSubFolders : function ftv_addSubFolders (folder, folders) {
for (let f in fixIterator(folder.subFolders, Components.interfaces.nsIMsgFolder)) {
for (let f of fixIterator(folder.subFolders, Components.interfaces.nsIMsgFolder)) {
folders.push(f);
this.addSubFolders(f, folders);
}
@ -2416,7 +2416,7 @@ ftvItem.prototype = {
this._children = [];
// Out of all children, only keep those that match the _folderFilter
// and those that contain such children.
for (let folder in iter) {
for (let folder of iter) {
if (!this._folderFilter || this._folderFilter(folder)) {
this._children.push(new ftvItem(folder, this._folderFilter));
}
@ -2826,13 +2826,13 @@ ftv_SmartItem.prototype = {
if (!this._children) {
this._children = [];
let iter = fixIterator(this._folder.subFolders, Ci.nsIMsgFolder);
for (let folder in iter) {
for (let folder of iter) {
if (!smartMode.isSmartFolder(folder)) {
this._children.push(new ftv_SmartItem(folder));
}
else if (folder.flags & nsMsgFolderFlags.Inbox) {
let subIter = fixIterator(folder.subFolders, Ci.nsIMsgFolder);
for (let subfolder in subIter) {
for (let subfolder of subIter) {
if (!smartMode.isSmartFolder(subfolder))
this._children.push(new ftv_SmartItem(subfolder));
}

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

@ -29,7 +29,7 @@ function getBestIdentity(identities, optionalHint, useDefault = false)
let hints = optionalHint.toLowerCase().split(",");
for (let i = 0 ; i < hints.length; i++) {
for (let identity in fixIterator(identities,
for (let identity of fixIterator(identities,
Components.interfaces.nsIMsgIdentity)) {
if (!identity.email)
continue;
@ -87,7 +87,7 @@ function getIdentityForHeader(hdr, type)
deliveredTos.reverse();
for (let i = 0; i < deliveredTos.length; i++) {
for (let identity in fixIterator(accountManager.allIdentities,
for (let identity of fixIterator(accountManager.allIdentities,
Components.interfaces.nsIMsgIdentity)) {
if (!identity.email)
continue;

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

@ -29,7 +29,7 @@ var MailUtils =
*/
discoverFolders: function MailUtils_discoverFolders() {
let servers = MailServices.accounts.allServers;
for (let server in fixIterator(servers, Ci.nsIMsgIncomingServer)) {
for (let server of fixIterator(servers, Ci.nsIMsgIncomingServer)) {
// Bug 466311 Sometimes this can throw file not found, we're unsure
// why, but catch it and log the fact.
try {
@ -58,7 +58,7 @@ var MailUtils =
function MailUtils_getFolderForFileInProfile(aFile) {
let folders = MailServices.accounts.allFolders;
for (let folder in fixIterator(folders, Ci.nsIMsgFolder)) {
for (let folder of fixIterator(folders, Ci.nsIMsgFolder)) {
if (folder.filePath.equals(aFile))
return folder;
}
@ -352,7 +352,7 @@ var MailUtils =
// - worker function
function* folder_string_setter_worker() {
for (let folder in fixIterator(allFolders, Ci.nsIMsgFolder)) {
for (let folder of fixIterator(allFolders, Ci.nsIMsgFolder)) {
// set the property; this may open the database...
let value = (typeof aPropertyValue == "function" ?
aPropertyValue(folder) : aPropertyValue);

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

@ -29,7 +29,7 @@ function GetCardForEmail(aEmailAddress) {
// the cardForEmailAddress function.
// Future expansion could be to domain matches
let books = MailServices.ab.directories;
for (let book in fixIterator(books, Components.interfaces.nsIAbDirectory)) {
for (let book of fixIterator(books, Components.interfaces.nsIAbDirectory)) {
try {
let card = book.cardForEmailAddress(aEmailAddress);
if (card)
@ -43,7 +43,7 @@ function GetCardForEmail(aEmailAddress) {
function _getIdentityForAddress(aEmailAddress) {
let emailAddress = aEmailAddress.toLowerCase();
for (let identity in fixIterator(MailServices.accounts.allIdentities,
for (let identity of fixIterator(MailServices.accounts.allIdentities,
Components.interfaces.nsIMsgIdentity)) {
if (!identity.email)
continue;

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

@ -160,7 +160,7 @@ SearchSpec.prototype = {
aCloneTerms){
let iTerm = 0, term;
let outTerms = aCloneTerms ? [] : aTerms;
for (term in fixIterator(aTerms, Ci.nsIMsgSearchTerm)) {
for (term of fixIterator(aTerms, Ci.nsIMsgSearchTerm)) {
if (aCloneTerms) {
let cloneTerm = this.session.createTerm();
cloneTerm.value = term.value;
@ -207,7 +207,7 @@ SearchSpec.prototype = {
let term;
let outTerms = aCloneTerms ? [] : aTerms;
let inGroup = false;
for (term in fixIterator(aTerms, Components.interfaces.nsIMsgSearchTerm)) {
for (term of fixIterator(aTerms, Components.interfaces.nsIMsgSearchTerm)) {
// If we're in a group, all that is forbidden is the creation of new
// groups.
if (inGroup) {
@ -369,7 +369,7 @@ SearchSpec.prototype = {
// -- apply terms
if (this._virtualFolderTerms) {
for (let term in fixIterator(this._virtualFolderTerms,
for (let term of fixIterator(this._virtualFolderTerms,
nsIMsgSearchTerm)) {
if (term.attrib == nsMsgSearchAttrib.Body)
haveBodyTerm = true;
@ -378,7 +378,7 @@ SearchSpec.prototype = {
}
if (this._viewTerms) {
for (let term in fixIterator(this._viewTerms,
for (let term of fixIterator(this._viewTerms,
nsIMsgSearchTerm)) {
if (term.attrib == nsMsgSearchAttrib.Body)
haveBodyTerm = true;
@ -387,7 +387,7 @@ SearchSpec.prototype = {
}
if (this._userTerms) {
for (let term in fixIterator(this._userTerms,
for (let term of fixIterator(this._userTerms,
nsIMsgSearchTerm)) {
if (term.attrib == nsMsgSearchAttrib.Body)
haveBodyTerm = true;
@ -434,7 +434,7 @@ SearchSpec.prototype = {
let offlineValidityTable = validityManager.getTable(offlineScope);
let offlineAvailable = true;
let onlineAvailable = true;
for (let term in fixIterator(session.searchTerms,
for (let term of fixIterator(session.searchTerms,
nsIMsgSearchTerm)) {
if (!term.matchAll) {
// for custom terms, we need to getAvailable from the custom term
@ -475,7 +475,7 @@ SearchSpec.prototype = {
let s = '';
for (let term in fixIterator(aSearchTerms, nsIMsgSearchTerm)) {
for (let term of fixIterator(aSearchTerms, nsIMsgSearchTerm)) {
s += ' ' + term.termAsString + '\n';
}