NS_RELEASE(doc);
nsHTMLFormElement::Reset(){  // XXX Need to do something special with mailto: or news: URLs  nsIDocument* doc = nsnull;  nsresult res = GetDocument(doc);  if (NS_SUCCEEDED(res) && doc) {    nsIPresShell *shell = doc->GetShellAt(0);    if (nsnull != shell) {      nsIFrame* frame;      shell->GetPrimaryFrameFor(this, &frame);      if (frame) {        nsIFormManager* formMan = nsnull;        res = frame->QueryInterface(kIFormManagerIID, (void**)&formMan);        if (NS_SUCCEEDED(res) && formMan) {          res = formMan->OnReset();        }      }      NS_RELEASE(shell);    }  }  return res;}