rem: var whatfor = labels[i].hasAttribute("for") ? theDocument.getElementById(labels[i].getAttribute("for")) : findFirstControl(labels[i]); 
add: label = labels[i]; var whatfor = label.hasAttribute("for") ? theDocument.getElementById(label.getAttribute("for")) : findFirstControl(label); 
context: function onFormSelect(){  var formTree = document.getElementById("formtree");  if (!formView.rowCount) return;  if (formView.selection.count == 1)  {    var formPreview = document.getElementById("formpreview");    fieldView.clear();    formPreview.treeBoxObject.view = fieldView;    var clickedRow = formView.selection.currentIndex;    var form = formView.getCellText(clickedRow, "form-node");    var ft = null;    if (form.name)      ft = theBundle.getFormattedString("formTitle", [form.name]);    else      ft = theBundle.getString("formUntitled");    document.getElementById("formname").value = ft || theBundle.getString("formUntitled");    document.getElementById("formenctype").value = form.encoding || theBundle.getString("default");    document.getElementById("formtarget").value = form.target || theBundle.getString("formDefaultTarget");    var formfields = findFormControls(form);    var length = formfields.length;    var i = 0;    var checked = theBundle.getString("formChecked");    var unchecked = theBundle.getString("formUnchecked");        for (i = 0; i < length; i++)    {      var elem = formfields[i], val;      if (elem instanceof nsIButtonElement)        val = getValueText(elem);      else        val = (/^password$/i.test(elem.type)) ? theBundle.getString("formPassword") : elem.value;      fieldView.addRow(["", elem.id || elem.name, elem.type, val]);    }    var labels = form.getElementsByTagName("label");    var llength = labels.length;    for (i = 0; i < llength; i++)    {      var whatfor = labels[i].hasAttribute("for") ?        theDocument.getElementById(labels[i].getAttribute("for")) :        findFirstControl(labels[i]);      if (whatfor && (whatfor.form == form)) {        var labeltext = getValueText(labels[i]);        for (var j = 0; j < length; j++)          if (formfields[j] == whatfor)            fieldView.setCellText(j, "field-label", labeltext);      }    }    fieldView.rowCountChanged(0, length);  }}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/9c0f6d358f061ae6653ec72d834b418c31573f6e/pageInfo.js/buggy/browser/base/content/pageInfo.js