nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(GetOwnerDoc()->GetScriptGlobalObject());
nsPIDOMWindow *window = GetOwnerDoc()->GetWindow();
nsHTMLFormElement::DoSubmit(nsEvent* aEvent){  NS_ASSERTION(!mIsSubmitting, "Either two people are trying to submit or the "               "previous submit was not properly cancelled by the DocShell");  NS_ASSERTION(GetCurrentDoc(), "Should never get here without a current doc");  if (mIsSubmitting) {    // XXX Should this return an error?    return NS_OK;  }  // Mark us as submitting so that we don't try to submit again  mIsSubmitting = PR_TRUE;  NS_ASSERTION(!mWebProgress && !mSubmittingRequest, "Web progress / submitting request should not exist here!");  nsCOMPtr<nsIFormSubmission> submission;     //  // prepare the submission object  //  BuildSubmission(submission, aEvent);   // XXXbz if the script global is that for an sXBL/XBL2 doc, it won't  // be a window...  nsCOMPtr<nsPIDOMWindow> window =    do_QueryInterface(GetOwnerDoc()->GetScriptGlobalObject());  if (window) {    mSubmitPopupState = window->GetPopupControlState();  } else {    mSubmitPopupState = openAbused;  }  mSubmitInitiatedFromUserInput = nsEventStateManager::IsHandlingUserInput();  if(mDeferSubmission) {     // we are in an event handler, JS submitted so we have to    // defer this submission. let's remember it and return    // without submitting    mPendingSubmission = submission;    // ensure reentrancy    mIsSubmitting = PR_FALSE;    return NS_OK;   }     //   // perform the submission  //  return SubmitSubmission(submission); }