nsCOMPtr<nsIDocument> doc = GetOwnerDoc();
nsCOMPtr<nsIDocument> doc = GetCurrentDoc(); if (!doc) { return rv; }
nsHTMLInputElement::Click(){  nsresult rv = NS_OK;  if (GET_BOOLBIT(mBitField, BF_HANDLING_CLICK)) // Fixes crash as in bug 41599      return rv;                      // --heikki@netscape.com  // first see if we are disabled or not. If disabled then do nothing.  nsAutoString disabled;  if (NS_CONTENT_ATTR_HAS_VALUE == GetAttr(kNameSpaceID_None,                                           nsHTMLAtoms::disabled, disabled)) {    return rv;  }  // see what type of input we are.  Only click button, checkbox, radio,  // reset, submit, & image  if (IsInDoc() &&      (mType == NS_FORM_INPUT_BUTTON   ||       mType == NS_FORM_INPUT_CHECKBOX ||       mType == NS_FORM_INPUT_RADIO    ||       mType == NS_FORM_INPUT_RESET    ||       mType == NS_FORM_INPUT_SUBMIT   ||       mType == NS_FORM_INPUT_IMAGE)) {    // Strong in case the event kills it    nsCOMPtr<nsIDocument> doc = GetOwnerDoc();    nsIPresShell *shell = doc->GetShellAt(0);    if (shell) {      nsCOMPtr<nsPresContext> context = shell->GetPresContext();      if (context) {        nsEventStatus status = nsEventStatus_eIgnore;        nsMouseEvent event(NS_MOUSE_LEFT_CLICK);        SET_BOOLBIT(mBitField, BF_HANDLING_CLICK, PR_TRUE);        rv = HandleDOMEvent(context, &event, nsnull, NS_EVENT_FLAG_INIT,                            &status);        SET_BOOLBIT(mBitField, BF_HANDLING_CLICK, PR_FALSE);      }    }  }    return NS_OK;}