nsCOMPtr<nsIDOMDocument> doc = do_QueryReferent(mDocWeak); if (!doc) return NS_ERROR_NOT_INITIALIZED; result = doc->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP));
result = GetDOMEventReceiver(getter_AddRefs(erP));
nsHTMLEditor::InstallEventListeners(){  NS_ASSERTION(mDocWeak, "no document set on this editor");  if (!mDocWeak) return NS_ERROR_NOT_INITIALIZED;  nsresult result;  // get a key listener  result = NS_NewEditorKeyListener(getter_AddRefs(mKeyListenerP), this);  if (NS_FAILED(result)) {    HandleEventListenerError();    return result;  }    // get a mouse listener  result = NS_NewEditorMouseListener(getter_AddRefs(mMouseListenerP), this);  if (NS_FAILED(result)) {    HandleEventListenerError();    return result;  }  // get a text listener  result = NS_NewEditorTextListener(getter_AddRefs(mTextListenerP),this);  if (NS_FAILED(result)) { #ifdef DEBUG_TAGUEprintf("nsTextEditor.cpp: failed to get TextEvent Listener\n");#endif    HandleEventListenerError();    return result;  }  // get a composition listener  result = NS_NewEditorCompositionListener(getter_AddRefs(mCompositionListenerP),this);  if (NS_FAILED(result)) { #ifdef DEBUG_TAGUEprintf("nsTextEditor.cpp: failed to get TextEvent Listener\n");#endif    HandleEventListenerError();    return result;  }  // get a drag listener  result = NS_NewEditorDragListener(getter_AddRefs(mDragListenerP), this);  if (NS_FAILED(result)) {    HandleEventListenerError();    return result;  }  // get a focus listener  result = NS_NewEditorFocusListener(getter_AddRefs(mFocusListenerP), this);  if (NS_FAILED(result)) {    HandleEventListenerError();    return result;  }  // get the DOM event receiver  nsCOMPtr<nsIDOMEventReceiver> erP;  nsCOMPtr<nsIDOMDocument> doc = do_QueryReferent(mDocWeak);  if (!doc) return NS_ERROR_NOT_INITIALIZED;  result = doc->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP));  if (NS_FAILED(result)) {    HandleEventListenerError();    return result;  }  // register the event listeners with the DOM event reveiver  result = erP->AddEventListenerByIID(mKeyListenerP, NS_GET_IID(nsIDOMKeyListener));  NS_ASSERTION(NS_SUCCEEDED(result), "failed to register key listener");  if (NS_SUCCEEDED(result))  {    result = erP->AddEventListenerByIID(mMouseListenerP, NS_GET_IID(nsIDOMMouseListener));    NS_ASSERTION(NS_SUCCEEDED(result), "failed to register mouse listener");    if (NS_SUCCEEDED(result))    {      result = erP->AddEventListenerByIID(mFocusListenerP, NS_GET_IID(nsIDOMFocusListener));      NS_ASSERTION(NS_SUCCEEDED(result), "failed to register focus listener");      if (NS_SUCCEEDED(result))      {        result = erP->AddEventListenerByIID(mTextListenerP, NS_GET_IID(nsIDOMTextListener));        NS_ASSERTION(NS_SUCCEEDED(result), "failed to register text listener");        if (NS_SUCCEEDED(result))        {          result = erP->AddEventListenerByIID(mCompositionListenerP, NS_GET_IID(nsIDOMCompositionListener));          NS_ASSERTION(NS_SUCCEEDED(result), "failed to register composition listener");          if (NS_SUCCEEDED(result))          {            result = erP->AddEventListenerByIID(mDragListenerP, NS_GET_IID(nsIDOMDragListener));            NS_ASSERTION(NS_SUCCEEDED(result), "failed to register drag listener");          }        }      }    }  }  if (NS_FAILED(result)) {    HandleEventListenerError();  }  return result;}