if (!mFrameSelection) return NS_OK;  if (mFrameSelection->GetBatching()){ mFrameSelection->SetDirty(); return NS_OK;
PRInt8 index = GetIndexFromSelectionType(aType); if (index >=0) { return mDomSelections[index]->NotifySelectionListeners();
nsTypedSelection::NotifySelectionListeners(){  if (!mFrameSelection)    return NS_OK;//nothing to do   if (mFrameSelection->GetBatching()){    mFrameSelection->SetDirty();    return NS_OK;  }  PRInt32 cnt = mSelectionListeners.Count();    nsCOMPtr<nsIDOMDocument> domdoc;  nsCOMPtr<nsIDocument> doc;  nsCOMPtr<nsIPresShell> shell;  nsresult rv = GetPresShell(getter_AddRefs(shell));  if (NS_SUCCEEDED(rv) && shell)  {    rv = shell->GetDocument(getter_AddRefs(doc));    if (NS_FAILED(rv))      doc = 0;    domdoc = do_QueryInterface(doc);  }  short reason = mFrameSelection->PopReason();  for (PRInt32 i = 0; i < cnt; i++)  {    nsISelectionListener* thisListener = mSelectionListeners[i];    if (thisListener)      thisListener->NotifySelectionChanged(domdoc, this, reason);  }  return NS_OK;}