if (aIndex < 0)
if (aIndex < -1) {
nsHTMLTableRowElement::InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aValue){  *aValue = nsnull;  if (aIndex < 0)    return NS_ERROR_DOM_INDEX_SIZE_ERR;    nsCOMPtr<nsIDOMHTMLCollection> cells;  GetCells(getter_AddRefs(cells));  PRUint32 cellCount;  cells->GetLength(&cellCount);  if (aIndex > PRInt32(cellCount))    return NS_ERROR_DOM_INDEX_SIZE_ERR;  PRBool doInsert = (aIndex < PRInt32(cellCount));  // create the cell  nsCOMPtr<nsIHTMLContent> cellContent;  nsCOMPtr<nsINodeInfo> nodeInfo;  mNodeInfo->NameChanged(nsHTMLAtoms::td, *getter_AddRefs(nodeInfo));  nsresult rv = NS_NewHTMLTableCellElement(getter_AddRefs(cellContent),                                           nodeInfo);  if (NS_SUCCEEDED(rv) && cellContent) {    nsCOMPtr<nsIDOMNode> cellNode(do_QueryInterface(cellContent));    if (NS_SUCCEEDED(rv) && cellNode) {      nsCOMPtr<nsIDOMNode> retChild;      if (doInsert) {        PRInt32 refIndex = PR_MAX(aIndex, 0);           nsCOMPtr<nsIDOMNode> refCell;        cells->Item(refIndex, getter_AddRefs(refCell));        rv = InsertBefore(cellNode, refCell, getter_AddRefs(retChild));      } else {        rv = AppendChild(cellNode, getter_AddRefs(retChild));      }      if (retChild) {        retChild->QueryInterface(NS_GET_IID(nsIDOMHTMLElement),                                 (void **)aValue);      }    }  }    return NS_OK;}