nsresult rv; nsCOMPtr<nsIPresShell> shell(do_QueryInterface(mTracker,&rv)); if (NS_FAILED(rv) || !shell) { return NS_ERROR_FAILURE; }  nsIDocument *doc = shell->GetDocument();
nsIDocument *doc = mShell->GetDocument();
NS_IMETHODIMP nsSelection::SelectAll(){  nsCOMPtr<nsIContent> rootContent;  if (mLimiter)  {    rootContent = mLimiter;//addrefit  }  else  {    nsresult rv;    nsCOMPtr<nsIPresShell> shell(do_QueryInterface(mTracker,&rv));    if (NS_FAILED(rv) || !shell) {      return NS_ERROR_FAILURE;    }    nsIDocument *doc = shell->GetDocument();    if (!doc)      return NS_ERROR_FAILURE;    rootContent = doc->GetRootContent();    if (!rootContent)      return NS_ERROR_FAILURE;  }  PRInt32 numChildren = rootContent->GetChildCount();  PostReason(nsISelectionListener::NO_REASON);  return TakeFocus(mLimiter, 0, numChildren, PR_FALSE, PR_FALSE);}