Bug 1293241 - fix getAccounts() in imAccounts.js to be used as a generator. r=aleth a=jorgk CLOSED TREE
authoraceman <acelists@atlas.sk>
Mon, 08 Aug 2016 15:45:00 +0200
changeset 19849 adc56f0cd5b514b27a96cebb31afe02503971b0c
parent 19848 378b9a66d495685964abbdfdd9da25879dd409ad
child 19850 800c3114b6f8ce4756d4984b1193337b328bfa4d
push id12156
push usermozilla@jorgk.com
push dateTue, 09 Aug 2016 03:24:04 +0000
treeherdercomm-central@adc56f0cd5b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaleth, jorgk
bugs1293241
Bug 1293241 - fix getAccounts() in imAccounts.js to be used as a generator. r=aleth a=jorgk CLOSED TREE
chat/content/imAccountOptionsHelper.js
mail/components/im/content/imAccountWizard.js
mail/components/im/content/imAccounts.js
--- a/chat/content/imAccountOptionsHelper.js
+++ b/chat/content/imAccountOptionsHelper.js
@@ -60,17 +60,17 @@ var accountOptionsHelper = {
 
     let containerType = "row";
 
     // TB's account options dialog doesn't use a grid element.
     if (rows.localName != "rows")
       containerType = "vbox";
 
     let haveOptions = false;
-    for (let opt in aOptions) {
+    for (let opt of aOptions) {
       let text = opt.label;
       let name = aIdPrefix + opt.name;
       switch (opt.type) {
         case Ci.prplIPref.typeBool:
           let chk = document.createElement("checkbox");
           chk.setAttribute("label", text);
           chk.setAttribute("id", name);
           if (opt.getBool())
--- a/mail/components/im/content/imAccountWizard.js
+++ b/mail/components/im/content/imAccountWizard.js
@@ -12,17 +12,17 @@ var accountWizard = {
   onload: function aw_onload() {
     // Ensure the im core is initialized before we get a list of protocols.
     Services.core.init();
 
     accountWizard.setGetMoreProtocols();
 
     var protoList = document.getElementById("protolist");
     var protos = [];
-    for (let proto in this.getProtocols())
+    for (let proto of this.getProtocols())
       protos.push(proto);
     protos.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
     protos.forEach(function(proto) {
       var id = proto.id;
       var item = protoList.appendItem(proto.name, id, id);
       item.setAttribute("image", proto.iconBaseURI + "icon.png");
       item.setAttribute("class", "listitem-iconic");
     });
@@ -126,17 +126,17 @@ var accountWizard = {
     document.getElementById("usernameInfo").textContent = usernameInfo;
 
     var vbox = document.getElementById("userNameBox");
     // remove anything that may be there for another protocol
     while (vbox.hasChildNodes())
       vbox.lastChild.remove();
 
     var splits = [];
-    for (let split in this.getProtoUserSplits())
+    for (let split of this.getProtoUserSplits())
       splits.push(split);
 
     var label = bundle.getString("accountUsername");
     this.userNameBoxes = [this.insertUsernameField("name", label, vbox)];
     this.userNameBoxes[0].emptyText = emptyText;
 
     for (let i = 0; i < splits.length; ++i) {
       this.userNameBoxes.push({value: splits[i].separator});
@@ -234,17 +234,17 @@ var accountWizard = {
 /* FIXME
     if (this.proto.newMailNotification)
       rows.appendChild(this.createSummaryRow("Notify of new mails:",
                                              this.getValue("newMailNotification")));
 */
 
     var id = this.proto.id;
     this.prefs = [ ];
-    for (let opt in this.getProtoOptions()) {
+    for (let opt of this.getProtoOptions()) {
       let name = opt.name;
       let eltName = id + "-" + name;
       let val = this.getValue(eltName);
       // The value will be undefined if the proto specific groupbox has never been opened
       if (val === undefined)
         continue;
       switch (opt.type) {
       case opt.typeBool:
--- a/mail/components/im/content/imAccounts.js
+++ b/mail/components/im/content/imAccounts.js
@@ -33,17 +33,17 @@ var gAccountManager = {
   disableTimerID: 0,
   _connectedLabelInterval: 0,
   load: function am_load() {
     // Wait until the password service is ready before offering anything.
     Services.logins.initializationPromise.then(() => {
       this.accountList = document.getElementById("accountlist");
       let defaultID;
       Services.core.init(); // ensure the imCore is initialized.
-      for (let acc in this.getAccounts()) {
+      for (let acc of this.getAccounts()) {
         var elt = document.createElement("richlistitem");
         this.accountList.appendChild(elt);
         elt.build(acc);
         if (!defaultID && acc.firstConnectionState == acc.FIRST_CONNECTION_CRASHED)
           defaultID = acc.id;
       }
       for (let event of events)
         Services.obs.addObserver(this, event, false);
@@ -75,17 +75,17 @@ var gAccountManager = {
   unload: function am_unload() {
     clearInterval(this._connectedLabelInterval);
     for (let event of events)
       Services.obs.removeObserver(this, event);
   },
   _updateAccountList: function am__updateAccountList() {
     let accountList = this.accountList;
     let i = 0;
-    for (let acc in this.getAccounts()) {
+    for (let acc of this.getAccounts()) {
       let oldItem = accountList.getItemAtIndex(i);
       if (oldItem.id != acc.id) {
         let accElt = document.getElementById(acc.id);
         accountList.insertBefore(accElt, oldItem);
         accElt.restoreItems();
       }
       ++i;
     }
@@ -475,17 +475,17 @@ var gAccountManager = {
     window.openDialog(aUrl, "", "chrome,modal,titlebar,centerscreen", aArgs);
     this.modalDialog = false;
   },
   setAutoLoginNotification: function am_setAutoLoginNotification() {
     var as = Services.accounts;
     var autoLoginStatus = as.autoLoginStatus;
     let isOffline = false;
     let crashCount = 0;
-    for (let acc in this.getAccounts())
+    for (let acc of this.getAccounts())
       if (acc.autoLogin && acc.firstConnectionState == acc.FIRST_CONNECTION_CRASHED)
         ++crashCount;
 
     if (autoLoginStatus == as.AUTOLOGIN_ENABLED && crashCount == 0) {
       let status = Services.core.globalUserStatus.statusType;
       this.setOffline(isOffline || status == Ci.imIStatusInfo.STATUS_OFFLINE);
       return;
     }