rem: firstButton.focus(); 
add: { var dButton; var defaultButton = gCommonDialogParam.GetInt(5); switch (defaultButton) { case 3: dButton = document.documentElement.getButton("extra2"); break; case 2: dButton = document.documentElement.getButton("extra1"); break; case 1: dButton = document.documentElement.getButton("cancel"); break; default: case 0: dButton = document.documentElement.getButton("accept"); break; }   document.documentElement.getButton("accept").setAttribute("default",false); dButton.setAttribute("default", true); dButton.focus(); }  if (gCommonDialogParam.GetInt(6) != 0) { var delayInterval = 2000; try { var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch); delayInterval = prefs.getIntPref("security.dialog_enable_delay"); } catch (e) {}  document.documentElement.getButton("accept").disabled = true; document.documentElement.getButton("extra1").disabled = true; document.documentElement.getButton("extra2").disabled = true;  setTimeout(commonDialogReenableButtons, delayInterval); } 
context: function commonDialogOnLoad(){  // set the window title  window.title = gCommonDialogParam.GetString(12);  // set the number of command buttons  var nButtons = gCommonDialogParam.GetInt(2);  var dialog = document.documentElement;  switch (nButtons) {    case 1:      dialog.getButton("cancel").hidden = true;      break;    case 4:      dialog.getButton("extra2").hidden = false;    case 3:      dialog.getButton("extra1").hidden = false;  }  // 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 descriptionNode = document.createElement("description");    var text = document.createTextNode(messageParagraphs[i]);    descriptionNode.appendChild(text);    messageParent.appendChild(descriptionNode);  }  setElementText("info.header", gCommonDialogParam.GetString(3), true);  // set the icon  var iconElement = document.getElementById("info.icon");  var iconClass = gCommonDialogParam.GetString(2);  if (!iconClass)    iconClass = "message-icon";  iconElement.setAttribute("class", iconElement.getAttribute("class") + " " + iconClass);  var firstButton = document.documentElement.getButton("accept");  switch (nButtons) {    case 4:      setLabelForNode(document.documentElement.getButton("extra2"), gCommonDialogParam.GetString(11));      // fall through    case 3:      setLabelForNode(document.documentElement.getButton("extra1"), gCommonDialogParam.GetString(10));      // fall through    default:    case 2:      var string = gCommonDialogParam.GetString(9);      if (string)        setLabelForNode(document.documentElement.getButton("cancel"), string);      // fall through    case 1:      string = gCommonDialogParam.GetString(8);      if (string)        setLabelForNode(firstButton, string);      break;  }  // set default result to cancelled  gCommonDialogParam.SetInt(0, 1);   // initialize the checkbox  setCheckbox(gCommonDialogParam.GetString(1), gCommonDialogParam.GetInt(1));  if (gCommonDialogParam.GetInt(3) == 0) // If no text fields    firstButton.focus(); // Don't focus checkbox, focus first button instead  getAttention();}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/16c8b2129f4cdc5d6f8b59a155838a79410bb294/commonDialog.js/clean/toolkit/content/commonDialog.js