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:
Родитель
e7686be172
Коммит
90d9557cc3
|
@ -849,7 +849,7 @@ function getServerThatCanHaveFilters()
|
||||||
// If it cannot, check all accounts to find a server
|
// If it cannot, check all accounts to find a server
|
||||||
// that can have filters.
|
// that can have filters.
|
||||||
let allServers = MailServices.accounts.allServers;
|
let allServers = MailServices.accounts.allServers;
|
||||||
for (let currentServer in fixIterator(allServers,
|
for (let currentServer of fixIterator(allServers,
|
||||||
Components.interfaces.nsIMsgIncomingServer))
|
Components.interfaces.nsIMsgIncomingServer))
|
||||||
{
|
{
|
||||||
if (currentServer.canHaveFilters)
|
if (currentServer.canHaveFilters)
|
||||||
|
|
|
@ -146,7 +146,7 @@ var editContactInlineUI = {
|
||||||
!list.isMailList)
|
!list.isMailList)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (let card in fixIterator(list.addressLists)) {
|
for (let card of fixIterator(list.addressLists)) {
|
||||||
if (card instanceof Components.interfaces.nsIAbCard &&
|
if (card instanceof Components.interfaces.nsIAbCard &&
|
||||||
card.primaryEmail == this._cardDetails.card.primaryEmail) {
|
card.primaryEmail == this._cardDetails.card.primaryEmail) {
|
||||||
inMailList = true;
|
inMailList = true;
|
||||||
|
|
|
@ -2163,7 +2163,7 @@ FolderDisplayWidget.prototype = {
|
||||||
|
|
||||||
const nsIMsgIdentity = Components.interfaces.nsIMsgIdentity;
|
const nsIMsgIdentity = Components.interfaces.nsIMsgIdentity;
|
||||||
let allEnabled = undefined;
|
let allEnabled = undefined;
|
||||||
for (let identity in fixIterator(serverIdentities, nsIMsgIdentity)) {
|
for (let identity of fixIterator(serverIdentities, nsIMsgIdentity)) {
|
||||||
if (allEnabled === undefined) {
|
if (allEnabled === undefined) {
|
||||||
allEnabled = identity.archiveEnabled;
|
allEnabled = identity.archiveEnabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1109,7 +1109,7 @@ var gFolderTreeView = {
|
||||||
|
|
||||||
_subFoldersWithStringProperty: function ftv_subFoldersWithStringProperty(folder, folders, aFolderName, deep)
|
_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 the folder selection is based on a string propery, use that
|
||||||
if (aFolderName == getSmartFolderName(child)) {
|
if (aFolderName == getSmartFolderName(child)) {
|
||||||
folders.push(child);
|
folders.push(child);
|
||||||
|
@ -1139,7 +1139,7 @@ var gFolderTreeView = {
|
||||||
for (let acct of accounts) {
|
for (let acct of accounts) {
|
||||||
let foldersWithFlag = acct.incomingServer.rootFolder.getFoldersWithFlags(aFolderFlag);
|
let foldersWithFlag = acct.incomingServer.rootFolder.getFoldersWithFlags(aFolderFlag);
|
||||||
if (foldersWithFlag.length > 0) {
|
if (foldersWithFlag.length > 0) {
|
||||||
for (let folderWithFlag in fixIterator(foldersWithFlag,
|
for (let folderWithFlag of fixIterator(foldersWithFlag,
|
||||||
Components.interfaces.nsIMsgFolder)) {
|
Components.interfaces.nsIMsgFolder)) {
|
||||||
folders.push(folderWithFlag);
|
folders.push(folderWithFlag);
|
||||||
// Add sub-folders of Sent and Archive to the result.
|
// Add sub-folders of Sent and Archive to the result.
|
||||||
|
@ -2011,7 +2011,7 @@ var gFolderTreeView = {
|
||||||
const Ci = Components.interfaces;
|
const Ci = Components.interfaces;
|
||||||
let folders = [];
|
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
|
// Skip deferred accounts
|
||||||
if (server instanceof Ci.nsIPop3IncomingServer &&
|
if (server instanceof Ci.nsIPop3IncomingServer &&
|
||||||
server.deferredToAccount)
|
server.deferredToAccount)
|
||||||
|
@ -2032,7 +2032,7 @@ var gFolderTreeView = {
|
||||||
* @param folders the array to add the folders to.
|
* @param folders the array to add the folders to.
|
||||||
*/
|
*/
|
||||||
addSubFolders : function ftv_addSubFolders (folder, folders) {
|
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);
|
folders.push(f);
|
||||||
this.addSubFolders(f, folders);
|
this.addSubFolders(f, folders);
|
||||||
}
|
}
|
||||||
|
@ -2416,7 +2416,7 @@ ftvItem.prototype = {
|
||||||
this._children = [];
|
this._children = [];
|
||||||
// Out of all children, only keep those that match the _folderFilter
|
// Out of all children, only keep those that match the _folderFilter
|
||||||
// and those that contain such children.
|
// and those that contain such children.
|
||||||
for (let folder in iter) {
|
for (let folder of iter) {
|
||||||
if (!this._folderFilter || this._folderFilter(folder)) {
|
if (!this._folderFilter || this._folderFilter(folder)) {
|
||||||
this._children.push(new ftvItem(folder, this._folderFilter));
|
this._children.push(new ftvItem(folder, this._folderFilter));
|
||||||
}
|
}
|
||||||
|
@ -2826,13 +2826,13 @@ ftv_SmartItem.prototype = {
|
||||||
if (!this._children) {
|
if (!this._children) {
|
||||||
this._children = [];
|
this._children = [];
|
||||||
let iter = fixIterator(this._folder.subFolders, Ci.nsIMsgFolder);
|
let iter = fixIterator(this._folder.subFolders, Ci.nsIMsgFolder);
|
||||||
for (let folder in iter) {
|
for (let folder of iter) {
|
||||||
if (!smartMode.isSmartFolder(folder)) {
|
if (!smartMode.isSmartFolder(folder)) {
|
||||||
this._children.push(new ftv_SmartItem(folder));
|
this._children.push(new ftv_SmartItem(folder));
|
||||||
}
|
}
|
||||||
else if (folder.flags & nsMsgFolderFlags.Inbox) {
|
else if (folder.flags & nsMsgFolderFlags.Inbox) {
|
||||||
let subIter = fixIterator(folder.subFolders, Ci.nsIMsgFolder);
|
let subIter = fixIterator(folder.subFolders, Ci.nsIMsgFolder);
|
||||||
for (let subfolder in subIter) {
|
for (let subfolder of subIter) {
|
||||||
if (!smartMode.isSmartFolder(subfolder))
|
if (!smartMode.isSmartFolder(subfolder))
|
||||||
this._children.push(new ftv_SmartItem(subfolder));
|
this._children.push(new ftv_SmartItem(subfolder));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ function getBestIdentity(identities, optionalHint, useDefault = false)
|
||||||
let hints = optionalHint.toLowerCase().split(",");
|
let hints = optionalHint.toLowerCase().split(",");
|
||||||
|
|
||||||
for (let i = 0 ; i < hints.length; i++) {
|
for (let i = 0 ; i < hints.length; i++) {
|
||||||
for (let identity in fixIterator(identities,
|
for (let identity of fixIterator(identities,
|
||||||
Components.interfaces.nsIMsgIdentity)) {
|
Components.interfaces.nsIMsgIdentity)) {
|
||||||
if (!identity.email)
|
if (!identity.email)
|
||||||
continue;
|
continue;
|
||||||
|
@ -87,7 +87,7 @@ function getIdentityForHeader(hdr, type)
|
||||||
deliveredTos.reverse();
|
deliveredTos.reverse();
|
||||||
|
|
||||||
for (let i = 0; i < deliveredTos.length; i++) {
|
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)) {
|
Components.interfaces.nsIMsgIdentity)) {
|
||||||
if (!identity.email)
|
if (!identity.email)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -29,7 +29,7 @@ var MailUtils =
|
||||||
*/
|
*/
|
||||||
discoverFolders: function MailUtils_discoverFolders() {
|
discoverFolders: function MailUtils_discoverFolders() {
|
||||||
let servers = MailServices.accounts.allServers;
|
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
|
// Bug 466311 Sometimes this can throw file not found, we're unsure
|
||||||
// why, but catch it and log the fact.
|
// why, but catch it and log the fact.
|
||||||
try {
|
try {
|
||||||
|
@ -58,7 +58,7 @@ var MailUtils =
|
||||||
function MailUtils_getFolderForFileInProfile(aFile) {
|
function MailUtils_getFolderForFileInProfile(aFile) {
|
||||||
let folders = MailServices.accounts.allFolders;
|
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))
|
if (folder.filePath.equals(aFile))
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
@ -352,7 +352,7 @@ var MailUtils =
|
||||||
|
|
||||||
// - worker function
|
// - worker function
|
||||||
function* folder_string_setter_worker() {
|
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...
|
// set the property; this may open the database...
|
||||||
let value = (typeof aPropertyValue == "function" ?
|
let value = (typeof aPropertyValue == "function" ?
|
||||||
aPropertyValue(folder) : aPropertyValue);
|
aPropertyValue(folder) : aPropertyValue);
|
||||||
|
|
|
@ -29,7 +29,7 @@ function GetCardForEmail(aEmailAddress) {
|
||||||
// the cardForEmailAddress function.
|
// the cardForEmailAddress function.
|
||||||
// Future expansion could be to domain matches
|
// Future expansion could be to domain matches
|
||||||
let books = MailServices.ab.directories;
|
let books = MailServices.ab.directories;
|
||||||
for (let book in fixIterator(books, Components.interfaces.nsIAbDirectory)) {
|
for (let book of fixIterator(books, Components.interfaces.nsIAbDirectory)) {
|
||||||
try {
|
try {
|
||||||
let card = book.cardForEmailAddress(aEmailAddress);
|
let card = book.cardForEmailAddress(aEmailAddress);
|
||||||
if (card)
|
if (card)
|
||||||
|
@ -43,7 +43,7 @@ function GetCardForEmail(aEmailAddress) {
|
||||||
|
|
||||||
function _getIdentityForAddress(aEmailAddress) {
|
function _getIdentityForAddress(aEmailAddress) {
|
||||||
let emailAddress = aEmailAddress.toLowerCase();
|
let emailAddress = aEmailAddress.toLowerCase();
|
||||||
for (let identity in fixIterator(MailServices.accounts.allIdentities,
|
for (let identity of fixIterator(MailServices.accounts.allIdentities,
|
||||||
Components.interfaces.nsIMsgIdentity)) {
|
Components.interfaces.nsIMsgIdentity)) {
|
||||||
if (!identity.email)
|
if (!identity.email)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -160,7 +160,7 @@ SearchSpec.prototype = {
|
||||||
aCloneTerms){
|
aCloneTerms){
|
||||||
let iTerm = 0, term;
|
let iTerm = 0, term;
|
||||||
let outTerms = aCloneTerms ? [] : aTerms;
|
let outTerms = aCloneTerms ? [] : aTerms;
|
||||||
for (term in fixIterator(aTerms, Ci.nsIMsgSearchTerm)) {
|
for (term of fixIterator(aTerms, Ci.nsIMsgSearchTerm)) {
|
||||||
if (aCloneTerms) {
|
if (aCloneTerms) {
|
||||||
let cloneTerm = this.session.createTerm();
|
let cloneTerm = this.session.createTerm();
|
||||||
cloneTerm.value = term.value;
|
cloneTerm.value = term.value;
|
||||||
|
@ -207,7 +207,7 @@ SearchSpec.prototype = {
|
||||||
let term;
|
let term;
|
||||||
let outTerms = aCloneTerms ? [] : aTerms;
|
let outTerms = aCloneTerms ? [] : aTerms;
|
||||||
let inGroup = false;
|
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
|
// If we're in a group, all that is forbidden is the creation of new
|
||||||
// groups.
|
// groups.
|
||||||
if (inGroup) {
|
if (inGroup) {
|
||||||
|
@ -369,7 +369,7 @@ SearchSpec.prototype = {
|
||||||
|
|
||||||
// -- apply terms
|
// -- apply terms
|
||||||
if (this._virtualFolderTerms) {
|
if (this._virtualFolderTerms) {
|
||||||
for (let term in fixIterator(this._virtualFolderTerms,
|
for (let term of fixIterator(this._virtualFolderTerms,
|
||||||
nsIMsgSearchTerm)) {
|
nsIMsgSearchTerm)) {
|
||||||
if (term.attrib == nsMsgSearchAttrib.Body)
|
if (term.attrib == nsMsgSearchAttrib.Body)
|
||||||
haveBodyTerm = true;
|
haveBodyTerm = true;
|
||||||
|
@ -378,7 +378,7 @@ SearchSpec.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._viewTerms) {
|
if (this._viewTerms) {
|
||||||
for (let term in fixIterator(this._viewTerms,
|
for (let term of fixIterator(this._viewTerms,
|
||||||
nsIMsgSearchTerm)) {
|
nsIMsgSearchTerm)) {
|
||||||
if (term.attrib == nsMsgSearchAttrib.Body)
|
if (term.attrib == nsMsgSearchAttrib.Body)
|
||||||
haveBodyTerm = true;
|
haveBodyTerm = true;
|
||||||
|
@ -387,7 +387,7 @@ SearchSpec.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._userTerms) {
|
if (this._userTerms) {
|
||||||
for (let term in fixIterator(this._userTerms,
|
for (let term of fixIterator(this._userTerms,
|
||||||
nsIMsgSearchTerm)) {
|
nsIMsgSearchTerm)) {
|
||||||
if (term.attrib == nsMsgSearchAttrib.Body)
|
if (term.attrib == nsMsgSearchAttrib.Body)
|
||||||
haveBodyTerm = true;
|
haveBodyTerm = true;
|
||||||
|
@ -434,7 +434,7 @@ SearchSpec.prototype = {
|
||||||
let offlineValidityTable = validityManager.getTable(offlineScope);
|
let offlineValidityTable = validityManager.getTable(offlineScope);
|
||||||
let offlineAvailable = true;
|
let offlineAvailable = true;
|
||||||
let onlineAvailable = true;
|
let onlineAvailable = true;
|
||||||
for (let term in fixIterator(session.searchTerms,
|
for (let term of fixIterator(session.searchTerms,
|
||||||
nsIMsgSearchTerm)) {
|
nsIMsgSearchTerm)) {
|
||||||
if (!term.matchAll) {
|
if (!term.matchAll) {
|
||||||
// for custom terms, we need to getAvailable from the custom term
|
// for custom terms, we need to getAvailable from the custom term
|
||||||
|
@ -475,7 +475,7 @@ SearchSpec.prototype = {
|
||||||
|
|
||||||
let s = '';
|
let s = '';
|
||||||
|
|
||||||
for (let term in fixIterator(aSearchTerms, nsIMsgSearchTerm)) {
|
for (let term of fixIterator(aSearchTerms, nsIMsgSearchTerm)) {
|
||||||
s += ' ' + term.termAsString + '\n';
|
s += ' ' + term.termAsString + '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче