rem: if (gDownloadsView.selected) { var idx = parseInt(gDownloadsView.selected.getAttribute("state")); 
add: if (gDownloadsView.selectedItem) { var idx = parseInt(gDownloadsView.selectedItem.getAttribute("state")); 
context: function buildContextMenu(aEvent){  if (aEvent.target.id != "downloadContextMenu")    return false;      var popup = document.getElementById("downloadContextMenu");  while (popup.hasChildNodes())    popup.removeChild(popup.firstChild);    if (gDownloadsView.selected) {    var idx = parseInt(gDownloadsView.selected.getAttribute("state"));    if (idx < 0)      idx = 0;        var menus = gContextMenus[idx];    for (var i = 0; i < menus.length; ++i)      popup.appendChild(document.getElementById(menus[i]).cloneNode(true));        return true;  }    return false;}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/148f27f947c26f83d75c5ad5c64f1169df23316b/downloads.js/buggy/toolkit/mozapps/downloads/content/downloads.js