nsEventStatus status = nsEventStatus_eIgnore; nsEvent event; event.eventStructType = NS_EVENT; event.message = NS_FORM_CHANGE; content->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status); }
nsCOMPtr<nsIContent> content = do_QueryInterface(updater->mElement); NS_ASSERTION(content != nsnull, "not an nsIContent"); if (! content) return NS_ERROR_UNEXPECTED;  nsCOMPtr<nsIDocument> document; rv = content->GetDocument(*getter_AddRefs(document)); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get document"); if (NS_FAILED(rv)) return rv;  NS_ASSERTION(document != nsnull, "element has no document"); if (! document) continue;  PRInt32 count = document->GetNumberOfShells(); for (PRInt32 i = 0; i < count; i++) { nsCOMPtr<nsIPresShell> shell = dont_AddRef(document->GetShellAt(i)); if (! shell) continue;   nsCOMPtr<nsIPresContext> context; rv = shell->GetPresContext(getter_AddRefs(context)); if (NS_FAILED(rv)) return rv;   nsEventStatus status = nsEventStatus_eIgnore; nsEvent event; event.eventStructType = NS_EVENT; event.message = NS_FORM_CHANGE; content->HandleDOMEvent(*context, &event, nsnull, NS_EVENT_FLAG_INIT, status); }
XULCommandDispatcherImpl::UpdateCommands(){  if (mFocusListeners) {    PRInt32 count = mFocusListeners->Count();    for (PRInt32 i = 0; i < count; i++) {      nsIDOMElement* domElement = (nsIDOMElement*)mFocusListeners->ElementAt(i);      nsCOMPtr<nsIContent> content;      content = do_QueryInterface(domElement);          nsCOMPtr<nsIDocument> document;      content->GetDocument(*getter_AddRefs(document));      PRInt32 count = document->GetNumberOfShells();      for (PRInt32 i = 0; i < count; i++) {        nsIPresShell* shell = document->GetShellAt(i);        if (nsnull == shell)            continue;        // Retrieve the context in which our DOM event will fire.        nsCOMPtr<nsIPresContext> aPresContext;        shell->GetPresContext(getter_AddRefs(aPresContext));          NS_RELEASE(shell);        // Handle the DOM event        nsEventStatus status = nsEventStatus_eIgnore;        nsEvent event;        event.eventStructType = NS_EVENT;        event.message = NS_FORM_CHANGE; // XXX: I feel dirty and evil for subverting this.        content->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);      }    }  }  return NS_OK;}