Bug 1577835 - Rewrite atypical for loops in mail/ for Prettier. r=mkmelin

This commit is contained in:
Paul Morris 2019-08-30 17:28:34 -04:00
Родитель 271c54efd3
Коммит f28d61bbe6
5 изменённых файлов: 17 добавлений и 12 удалений

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

@ -91,7 +91,8 @@ function FindNextFolder() {
// didn't find folder in children
// go up to the parent, and start at the folder after the current one
// unless we are at a server, in which case bail out.
for (folder = gDBView.msgFolder; !folder.isServer;) {
folder = gDBView.msgFolder;
while (!folder.isServer) {
var parent = folder.parent;
folder = FindNextChildFolder(parent, folder);
if (folder) {

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

@ -721,7 +721,8 @@
setTimeout(() => {
for (let modeName of Object.keys(aTabType.modes)) {
for (let i = 0; i < this.unrestoredTabs.length;) {
let i = 0;
while (i < this.unrestoredTabs.length) {
let state = this.unrestoredTabs[i];
if (state.mode == modeName) {
this.restoreTab(state);

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

@ -325,7 +325,7 @@ function OnLoadEditCard() {
if (directory.readOnly) {
// Set all the editable vcard fields to read only
for (var i = kVcardFields.length; i-- > 0;) {
for (let i = kVcardFields.length - 1; i >= 0; i--) {
document.getElementById(kVcardFields[i][0]).readOnly = true;
}
@ -426,7 +426,7 @@ function InitPhoneticFields() {
// show phonetic fields if indicated by the pref
if (showPhoneticFields == "true") {
for (var i = kPhoneticFields.length; i-- > 0;) {
for (var i = kPhoneticFields.length - 1; i >= 0; i--) {
document.getElementById(kPhoneticFields[i]).hidden = false;
}
}
@ -568,7 +568,7 @@ function GetCardValues(cardproperty, doc) {
// to give extensions a chance to populate custom fields.
NotifyLoadListeners(cardproperty, doc);
for (var i = kVcardFields.length; i-- > 0;) {
for (var i = kVcardFields.length - 1; i >= 0; i--) {
doc.getElementById(kVcardFields[i][0]).value = cardproperty.getProperty(
kVcardFields[i][1],
""
@ -649,10 +649,10 @@ function HideNonVcardFields() {
document.getElementById("chatTabButton").hidden = true;
document.getElementById("photoTabButton").hidden = true;
var i;
for (i = kNonVcardFields.length; i-- > 0;) {
for (i = kNonVcardFields.length - 1; i >= 0; i--) {
document.getElementById(kNonVcardFields[i]).collapsed = true;
}
for (i = kPhoneticFields.length; i-- > 0;) {
for (i = kPhoneticFields.length - 1; i >= 0; i--) {
document.getElementById(kPhoneticFields[i]).collapsed = true;
}
}
@ -670,7 +670,7 @@ function CheckAndSetCardValues(cardproperty, doc, check) {
return true;
}
for (var i = kVcardFields.length; i-- > 0;) {
for (var i = kVcardFields.length - 1; i >= 0; i--) {
cardproperty.setProperty(
kVcardFields[i][1],
doc.getElementById(kVcardFields[i][0]).value

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

@ -49,7 +49,8 @@ if (!customElements.get("menulist")) {
if (aItem instanceof Ci.nsIAbDirectory) {
// Find the item in the list to remove.
// We can't use indexOf here because we need loose equality.
for (var index = this._directories.length; --index >= 0;) {
let len = this._directories.length;
for (var index = len - 1; index >= 0; index--) {
if (this._directories[index] == aItem) {
break;
}
@ -76,7 +77,8 @@ if (!customElements.get("menulist")) {
if (aItem instanceof Ci.nsIAbDirectory) {
// Find the item in the list to rename.
// We can't use indexOf here because we need loose equality.
for (var oldIndex = this._directories.length; --oldIndex >= 0;) {
let len = this._directories.length;
for (var oldIndex = len - 1; oldIndex >= 0; oldIndex--) {
if (this._directories[oldIndex] == aItem) {
break;
}

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

@ -159,9 +159,10 @@ var triggerKeyEvent = function(
// If we have an element check if it needs to be focused
if (element.ownerDocument) {
var focusedElement = utils.getChromeWindow(win).document.commandDispatcher
let focusedElement = utils.getChromeWindow(win).document.commandDispatcher
.focusedElement;
for (var node = focusedElement; node && node != element;) {
let node = focusedElement;
while (node && node != element) {
node = node.parentNode;
}