rem: for (var i = 0; i < visibilityList.length; i++) { 
add: for (i = 0; i < visibilityList.length; i++) { 
context: function commonDialogOnLoad(){  doSetOKCancel(commonDialogOnOK, commonDialogOnCancel, commonDialogOnButton2, commonDialogOnButton3);  gCommonDialogParam = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);	  // display the main text  var messageText = gCommonDialogParam.GetString(0);  var messageParent = document.getElementById("info.box");  var messageParagraphs = messageText.split("\n");    for (var i = 0; i < messageParagraphs.length; i++) {    var htmlNode = document.createElement("html");    //htmlNode.setAttribute("style", "max-width: 45em;");    var text = document.createTextNode(messageParagraphs[i]);    htmlNode.appendChild(text);    messageParent.appendChild(htmlNode);  }    setElementText("info.header", gCommonDialogParam.GetString(3), true);       // set the window title  window.title = gCommonDialogParam.GetString(12);    // set the icon	  var iconElement = document.getElementById("info.icon");  var iconURL = gCommonDialogParam.GetString(2);  if (iconURL)    iconElement.setAttribute("src", iconURL);    // set the number of command buttons  var nButtons = gCommonDialogParam.GetInt(2);  if (nButtons == 1) hideElementById("cancel");  switch (nButtons) {    case 4:      unHideElementByID("Button3");      setElementText("Button3", gCommonDialogParam.GetString(11));      // fall through    case 3:      unHideElementByID("Button2");      setElementText("Button2", gCommonDialogParam.GetString(10));      // fall through    default:    case 2:      var string = gCommonDialogParam.GetString(8);      if (string)        setElementText("ok", string);      // fall through    case 1:      string = gCommonDialogParam.GetString(9);      if (string)        setElementText("cancel", string);      break;  }  // initialize the checkbox  setCheckbox(gCommonDialogParam.GetString(1), gCommonDialogParam.GetInt(1));	  // initialize the edit fields  var nEditFields = gCommonDialogParam.GetInt(3);    switch (nEditFields) {    case 2:      var password2Container = document.getElementById("password2EditField");      password2Container.removeAttribute("collapsed");      var password2Field = document.getElementById("dialog.password2");      password2Field.value = gCommonDialogParam.GetString(7);            var password2Label = gCommonDialogParam.GetString(5);      if (password2Label)        setElementText("password2.text", password2Label);              var containerID, fieldID, labelID;      if (gCommonDialogParam.GetInt(4) == 1) {        // two password fields ('password' and 'retype password')        containerID = "password1EditField";        fieldID = "dialog.password1";        labelID = "password1.text";      }      else {        containerID = "loginEditField";        fieldID = "dialog.loginname";        labelID = "login.text";      }                unHideElementByID(containerID);      var field = document.getElementById(fieldID);      field.value = gCommonDialogParam.GetString(6);                var label = gCommonDialogParam.GetString(4);      if (label)        setElementText(labelID, label);      field.focus();      break;    case 1:      var editFieldIsPassword = gCommonDialogParam.GetInt(4);      if (editFieldIsPassword == 1) {        containerID = "password1EditField";        fieldID = "dialog.password1";        setElementText("password1.text", ""); // hide the meaningless text      }      else {        containerID = "loginEditField";        fieldID = "dialog.loginname";        setElementText("login.text", gCommonDialogParam.GetString(4));      }            unHideElementByID(containerID);      field = document.getElementById(fieldID);      field.value = gCommonDialogParam.GetString(6);      field.focus();      break;  }	  // set the pressed button to cancel to handle the case where the close box is pressed  gCommonDialogParam.SetInt(0, 1);  // set default focus  // preferred order is textfield1, textfield2, textfield 3, OK, cancel, button2, button3  var visibilityList = ["loginEditField", "password1EditField", "password2EditField", "ok",                         "cancel", "Button2", "Button3"]  var focusList      = ["dialog.loginname", "dialog.password1", "dialog.password2", "ok",                         "cancel", "Button2", "Button3"]  for (var i = 0; i < visibilityList.length; i++) {    if (isVisible(visibilityList[i])) {      document.getElementById(focusList[i]).focus();      break;    }  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/6c344b08cc7d250a0a2b6125b25848896368185f/commonDialog.js/buggy/xpfe/global/resources/content/commonDialog.js