Bug 1478572 - Turn on ESLint in mail/components/compose, mass whitespace changes; rs=whitespace-only
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 26 Sep 2018 11:32:07 +1200
changeset 33229 9a567595d18a5e0a8aa8ba229fba6e080a82a620
parent 33228 49bf37634232a6237ccc84219a365000affc9739
child 33230 d900f4b75757f47d21d8c9404488438c7724e877
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewerswhitespace-only
bugs1478572
Bug 1478572 - Turn on ESLint in mail/components/compose, mass whitespace changes; rs=whitespace-only
mail/components/compose/content/MsgComposeCommands.js
mail/components/compose/content/addressingWidgetOverlay.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -542,70 +542,70 @@ var gSendListener = {
       Services.obs.notifyObservers(null, "mail:composeSendSucceeded");
   },
   onGetDraftFolderURI(aFolderURI) {},
   onSendNotPerformed(aMsgID, aStatus) {},
 };
 
 // all progress notifications are done through the nsIWebProgressListener implementation...
 var progressListener = {
-    onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
-      if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
-        document.getElementById("compose-progressmeter").setAttribute("mode", "undetermined");
-        document.getElementById("statusbar-progresspanel").collapsed = false;
-      }
-
-      if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
-        gSendOperationInProgress = false;
-        gSaveOperationInProgress = false;
-        document.getElementById("compose-progressmeter").setAttribute("mode", "normal");
-        document.getElementById("compose-progressmeter").setAttribute("value", 0);
-        document.getElementById("statusbar-progresspanel").collapsed = true;
-        document.getElementById("statusText").setAttribute("label", "");
-      }
-    },
-
-    onProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) {
-      // Calculate percentage.
-      var percent;
-      if (aMaxTotalProgress > 0) {
-        percent = Math.round((aCurTotalProgress * 100) / aMaxTotalProgress);
-        if (percent > 100)
-          percent = 100;
-
-        document.getElementById("compose-progressmeter").removeAttribute("mode");
-
-        // Advance progress meter.
-        document.getElementById("compose-progressmeter").setAttribute("value", percent);
-      } else {
-        // Progress meter should be barber-pole in this case.
-        document.getElementById("compose-progressmeter").setAttribute("mode", "undetermined");
-      }
-    },
-
-    onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
-      // we can ignore this notification
-    },
-
-    onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
-      // Looks like it's possible that we get call while the document has been already delete!
-      // therefore we need to protect ourself by using try/catch
-      try {
-        let statusText = document.getElementById("statusText");
-        if (statusText)
-          statusText.setAttribute("label", aMessage);
-      } catch (ex) {}
-    },
-
-    onSecurityChange(aWebProgress, aRequest, state) {
-      // we can ignore this notification
-    },
-
-    QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
-                                            "nsISupportsWeakReference"]),
+  onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
+    if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
+      document.getElementById("compose-progressmeter").setAttribute("mode", "undetermined");
+      document.getElementById("statusbar-progresspanel").collapsed = false;
+    }
+
+    if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
+      gSendOperationInProgress = false;
+      gSaveOperationInProgress = false;
+      document.getElementById("compose-progressmeter").setAttribute("mode", "normal");
+      document.getElementById("compose-progressmeter").setAttribute("value", 0);
+      document.getElementById("statusbar-progresspanel").collapsed = true;
+      document.getElementById("statusText").setAttribute("label", "");
+    }
+  },
+
+  onProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) {
+    // Calculate percentage.
+    var percent;
+    if (aMaxTotalProgress > 0) {
+      percent = Math.round((aCurTotalProgress * 100) / aMaxTotalProgress);
+      if (percent > 100)
+        percent = 100;
+
+      document.getElementById("compose-progressmeter").removeAttribute("mode");
+
+      // Advance progress meter.
+      document.getElementById("compose-progressmeter").setAttribute("value", percent);
+    } else {
+      // Progress meter should be barber-pole in this case.
+      document.getElementById("compose-progressmeter").setAttribute("mode", "undetermined");
+    }
+  },
+
+  onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
+    // we can ignore this notification
+  },
+
+  onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
+    // Looks like it's possible that we get call while the document has been already delete!
+    // therefore we need to protect ourself by using try/catch
+    try {
+      let statusText = document.getElementById("statusText");
+      if (statusText)
+        statusText.setAttribute("label", aMessage);
+    } catch (ex) {}
+  },
+
+  onSecurityChange(aWebProgress, aRequest, state) {
+    // we can ignore this notification
+  },
+
+  QueryInterface: ChromeUtils.generateQI(["nsIWebProgressListener",
+                                          "nsISupportsWeakReference"]),
 };
 
 var defaultController = {
   commands: {
     cmd_attachFile: {
       isEnabled() {
         return !gWindowLocked;
       },
@@ -5427,161 +5427,161 @@ function hideIrrelevantAddressingOptions
   // Collapsing the menuitem only prevents it getting chosen, it does not
   // affect the menulist widget display when Newsgroup is already selected.
   for (let item of newsTypes) {
     item.collapsed = hideNews;
   }
 }
 
 function LoadIdentity(startup) {
-    var identityElement = document.getElementById("msgIdentity");
-    var prevIdentity = gCurrentIdentity;
-
-    if (identityElement) {
-        var idKey = identityElement.selectedItem.getAttribute("identitykey");
-        gCurrentIdentity = MailServices.accounts.getIdentity(idKey);
-
-        let accountKey = null;
-        // Set the account key value on the menu list.
-        if (identityElement.selectedItem) {
-          accountKey = identityElement.selectedItem.getAttribute("accountkey");
-          identityElement.setAttribute("accountkey", accountKey);
-          hideIrrelevantAddressingOptions(accountKey);
-        }
-
-        let maxRecipients = awGetMaxRecipients();
-        for (let i = 1; i <= maxRecipients; i++) {
-          let params = JSON.parse(awGetInputElement(i).searchParam);
-          params.idKey = idKey;
-          params.accountKey = accountKey;
-          awGetInputElement(i).searchParam = JSON.stringify(params);
+  var identityElement = document.getElementById("msgIdentity");
+  var prevIdentity = gCurrentIdentity;
+
+  if (identityElement) {
+    var idKey = identityElement.selectedItem.getAttribute("identitykey");
+    gCurrentIdentity = MailServices.accounts.getIdentity(idKey);
+
+    let accountKey = null;
+    // Set the account key value on the menu list.
+    if (identityElement.selectedItem) {
+      accountKey = identityElement.selectedItem.getAttribute("accountkey");
+      identityElement.setAttribute("accountkey", accountKey);
+      hideIrrelevantAddressingOptions(accountKey);
+    }
+
+    let maxRecipients = awGetMaxRecipients();
+    for (let i = 1; i <= maxRecipients; i++) {
+      let params = JSON.parse(awGetInputElement(i).searchParam);
+      params.idKey = idKey;
+      params.accountKey = accountKey;
+      awGetInputElement(i).searchParam = JSON.stringify(params);
+    }
+
+    if (!startup && prevIdentity && idKey != prevIdentity.key) {
+      var prevReplyTo = prevIdentity.replyTo;
+      var prevCc = "";
+      var prevBcc = "";
+      var prevReceipt = prevIdentity.requestReturnReceipt;
+      var prevDSN = prevIdentity.DSN;
+      var prevAttachVCard = prevIdentity.attachVCard;
+
+      if (prevIdentity.doCc)
+        prevCc += prevIdentity.doCcList;
+
+      if (prevIdentity.doBcc)
+        prevBcc += prevIdentity.doBccList;
+
+      var newReplyTo = gCurrentIdentity.replyTo;
+      var newCc = "";
+      var newBcc = "";
+      var newReceipt = gCurrentIdentity.requestReturnReceipt;
+      var newDSN = gCurrentIdentity.DSN;
+      var newAttachVCard = gCurrentIdentity.attachVCard;
+
+      if (gCurrentIdentity.doCc)
+        newCc += gCurrentIdentity.doCcList;
+
+      if (gCurrentIdentity.doBcc)
+        newBcc += gCurrentIdentity.doBccList;
+
+      var needToCleanUp = false;
+      var msgCompFields = gMsgCompose.compFields;
+
+      if (!gReceiptOptionChanged &&
+          prevReceipt == msgCompFields.returnReceipt &&
+          prevReceipt != newReceipt) {
+        msgCompFields.returnReceipt = newReceipt;
+        document.getElementById("returnReceiptMenu").setAttribute("checked", msgCompFields.returnReceipt);
+      }
+
+      if (!gDSNOptionChanged &&
+          prevDSN == msgCompFields.DSN &&
+          prevDSN != newDSN) {
+        msgCompFields.DSN = newDSN;
+        document.getElementById("dsnMenu").setAttribute("checked", msgCompFields.DSN);
+      }
+
+      if (!gAttachVCardOptionChanged &&
+          prevAttachVCard == msgCompFields.attachVCard &&
+          prevAttachVCard != newAttachVCard) {
+        msgCompFields.attachVCard = newAttachVCard;
+        document.getElementById("cmd_attachVCard").setAttribute("checked", msgCompFields.attachVCard);
+      }
+
+      if (newReplyTo != prevReplyTo) {
+        needToCleanUp = true;
+        if (prevReplyTo != "")
+          awRemoveRecipients(msgCompFields, "addr_reply", prevReplyTo);
+        if (newReplyTo != "")
+          awAddRecipients(msgCompFields, "addr_reply", newReplyTo);
+      }
+
+      let toAddrs = new Set(msgCompFields.splitRecipients(
+        msgCompFields.to, true, {}));
+      let ccAddrs = new Set(msgCompFields.splitRecipients(
+        msgCompFields.cc, true, {}));
+
+      if (newCc != prevCc) {
+        needToCleanUp = true;
+        if (prevCc)
+          awRemoveRecipients(msgCompFields, "addr_cc", prevCc);
+        if (newCc) {
+          // Ensure none of the Ccs are already in To.
+          let cc2 = msgCompFields.splitRecipients(newCc, true, {});
+          newCc = cc2.filter(x => !toAddrs.has(x)).join(", ");
+          awAddRecipients(msgCompFields, "addr_cc", newCc);
         }
-
-        if (!startup && prevIdentity && idKey != prevIdentity.key) {
-          var prevReplyTo = prevIdentity.replyTo;
-          var prevCc = "";
-          var prevBcc = "";
-          var prevReceipt = prevIdentity.requestReturnReceipt;
-          var prevDSN = prevIdentity.DSN;
-          var prevAttachVCard = prevIdentity.attachVCard;
-
-          if (prevIdentity.doCc)
-            prevCc += prevIdentity.doCcList;
-
-          if (prevIdentity.doBcc)
-            prevBcc += prevIdentity.doBccList;
-
-          var newReplyTo = gCurrentIdentity.replyTo;
-          var newCc = "";
-          var newBcc = "";
-          var newReceipt = gCurrentIdentity.requestReturnReceipt;
-          var newDSN = gCurrentIdentity.DSN;
-          var newAttachVCard = gCurrentIdentity.attachVCard;
-
-          if (gCurrentIdentity.doCc)
-            newCc += gCurrentIdentity.doCcList;
-
-          if (gCurrentIdentity.doBcc)
-            newBcc += gCurrentIdentity.doBccList;
-
-          var needToCleanUp = false;
-          var msgCompFields = gMsgCompose.compFields;
-
-          if (!gReceiptOptionChanged &&
-              prevReceipt == msgCompFields.returnReceipt &&
-              prevReceipt != newReceipt) {
-            msgCompFields.returnReceipt = newReceipt;
-            document.getElementById("returnReceiptMenu").setAttribute("checked", msgCompFields.returnReceipt);
-          }
-
-          if (!gDSNOptionChanged &&
-              prevDSN == msgCompFields.DSN &&
-              prevDSN != newDSN) {
-            msgCompFields.DSN = newDSN;
-            document.getElementById("dsnMenu").setAttribute("checked", msgCompFields.DSN);
-          }
-
-          if (!gAttachVCardOptionChanged &&
-              prevAttachVCard == msgCompFields.attachVCard &&
-              prevAttachVCard != newAttachVCard) {
-            msgCompFields.attachVCard = newAttachVCard;
-            document.getElementById("cmd_attachVCard").setAttribute("checked", msgCompFields.attachVCard);
-          }
-
-          if (newReplyTo != prevReplyTo) {
-            needToCleanUp = true;
-            if (prevReplyTo != "")
-              awRemoveRecipients(msgCompFields, "addr_reply", prevReplyTo);
-            if (newReplyTo != "")
-              awAddRecipients(msgCompFields, "addr_reply", newReplyTo);
-          }
-
-          let toAddrs = new Set(msgCompFields.splitRecipients(
-            msgCompFields.to, true, {}));
-          let ccAddrs = new Set(msgCompFields.splitRecipients(
-            msgCompFields.cc, true, {}));
-
-          if (newCc != prevCc) {
-            needToCleanUp = true;
-            if (prevCc)
-              awRemoveRecipients(msgCompFields, "addr_cc", prevCc);
-            if (newCc) {
-              // Ensure none of the Ccs are already in To.
-              let cc2 = msgCompFields.splitRecipients(newCc, true, {});
-              newCc = cc2.filter(x => !toAddrs.has(x)).join(", ");
-              awAddRecipients(msgCompFields, "addr_cc", newCc);
-            }
-          }
-
-          if (newBcc != prevBcc) {
-            needToCleanUp = true;
-            if (prevBcc)
-              awRemoveRecipients(msgCompFields, "addr_bcc", prevBcc);
-            if (newBcc) {
-              // Ensure none of the Bccs are already in To or Cc.
-              let bcc2 = msgCompFields.splitRecipients(newBcc, true, {});
-              let toCcAddrs = new Set([...toAddrs, ...ccAddrs]);
-              newBcc = bcc2.filter(x => !toCcAddrs.has(x)).join(", ");
-              awAddRecipients(msgCompFields, "addr_bcc", newBcc);
-            }
-          }
-
-          if (needToCleanUp)
-            awCleanupRows();
-
-          try {
-            gMsgCompose.identity = gCurrentIdentity;
-          } catch (ex) {
-            dump("### Cannot change the identity: " + ex + "\n");
-          }
-
-          var event = document.createEvent("Events");
-          event.initEvent("compose-from-changed", false, true);
-          document.getElementById("msgcomposeWindow").dispatchEvent(event);
-
-          gComposeNotificationBar.clearIdentityWarning();
+      }
+
+      if (newBcc != prevBcc) {
+        needToCleanUp = true;
+        if (prevBcc)
+          awRemoveRecipients(msgCompFields, "addr_bcc", prevBcc);
+        if (newBcc) {
+          // Ensure none of the Bccs are already in To or Cc.
+          let bcc2 = msgCompFields.splitRecipients(newBcc, true, {});
+          let toCcAddrs = new Set([...toAddrs, ...ccAddrs]);
+          newBcc = bcc2.filter(x => !toCcAddrs.has(x)).join(", ");
+          awAddRecipients(msgCompFields, "addr_bcc", newBcc);
         }
-
-      if (!startup) {
-          if (getPref("mail.autoComplete.highlightNonMatches"))
-            document.getElementById("addressCol2#1").highlightNonMatches = true;
-
-          // Only do this if we aren't starting up...
-          // It gets done as part of startup already.
-          addRecipientsToIgnoreList(gCurrentIdentity.fullAddress);
-
-          // If the From field is editable, reset the address from the identity.
-          if (identityElement.editable) {
-            identityElement.value = identityElement.selectedItem.value;
-            identityElement.inputField.placeholder = getComposeBundle().getFormattedString(
-              "msgIdentityPlaceholder", [identityElement.selectedItem.value]
-            );
-          }
+      }
+
+      if (needToCleanUp)
+        awCleanupRows();
+
+      try {
+        gMsgCompose.identity = gCurrentIdentity;
+      } catch (ex) {
+        dump("### Cannot change the identity: " + ex + "\n");
+      }
+
+      var event = document.createEvent("Events");
+      event.initEvent("compose-from-changed", false, true);
+      document.getElementById("msgcomposeWindow").dispatchEvent(event);
+
+      gComposeNotificationBar.clearIdentityWarning();
+    }
+
+    if (!startup) {
+      if (getPref("mail.autoComplete.highlightNonMatches"))
+        document.getElementById("addressCol2#1").highlightNonMatches = true;
+
+      // Only do this if we aren't starting up...
+      // It gets done as part of startup already.
+      addRecipientsToIgnoreList(gCurrentIdentity.fullAddress);
+
+      // If the From field is editable, reset the address from the identity.
+      if (identityElement.editable) {
+        identityElement.value = identityElement.selectedItem.value;
+        identityElement.inputField.placeholder = getComposeBundle().getFormattedString(
+          "msgIdentityPlaceholder", [identityElement.selectedItem.value]
+        );
       }
     }
+  }
 }
 
 function MakeFromFieldEditable(ignoreWarning) {
   let bundle = getComposeBundle();
   if (!ignoreWarning && !getPref("mail.compose.warned_about_customize_from")) {
     var check = { value: false };
     if (Services.prompt.confirmEx(window,
           bundle.getString("customizeFromAddressTitle"),
--- a/mail/components/compose/content/addressingWidgetOverlay.js
+++ b/mail/components/compose/content/addressingWidgetOverlay.js
@@ -268,26 +268,26 @@ function awSetInputAndPopupValue(inputEl
 
   _awSetAutoComplete(popupElem, inputElem);
 
   if (aNotifyRecipientsChanged)
     onRecipientsChanged(true);
 }
 
 function _awSetInputAndPopup(inputValue, popupValue, parentNode, templateNode) {
-    top.MAX_RECIPIENTS++;
+  top.MAX_RECIPIENTS++;
 
-    var newNode = templateNode.cloneNode(true);
-    parentNode.appendChild(newNode); // we need to insert the new node before we set the value of the select element!
+  var newNode = templateNode.cloneNode(true);
+  parentNode.appendChild(newNode); // we need to insert the new node before we set the value of the select element!
 
-    var input = newNode.getElementsByTagName(awInputElementName());
-    var select = newNode.getElementsByTagName(awSelectElementName());
+  var input = newNode.getElementsByTagName(awInputElementName());
+  var select = newNode.getElementsByTagName(awSelectElementName());
 
-    if (input && input.length == 1 && select && select.length == 1)
-      awSetInputAndPopupValue(input[0], inputValue, select[0], popupValue, top.MAX_RECIPIENTS);
+  if (input && input.length == 1 && select && select.length == 1)
+    awSetInputAndPopupValue(input[0], inputValue, select[0], popupValue, top.MAX_RECIPIENTS);
 }
 
 function awSetInputAndPopup(inputValue, popupValue, parentNode, templateNode) {
   if (inputValue && popupValue) {
     var addressArray = inputValue.split(",");
 
     for (var index = 0; index < addressArray.length; index++)
       _awSetInputAndPopup(addressArray[index], popupValue, parentNode, templateNode);