nsIFocusTracker *tracker = mFrameSelection->GetTracker();
nsIPresShell *shell = mFrameSelection->GetShell();
nsTypedSelection::GetPresShell(nsIPresShell **aPresShell){  if (mPresShellWeak)  {    nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);    if (presShell)      NS_ADDREF(*aPresShell = presShell);    return NS_OK;  }  nsresult rv = NS_OK;  if (!mFrameSelection)    return NS_ERROR_FAILURE;//nothing to do  nsIFocusTracker *tracker = mFrameSelection->GetTracker();  if (!tracker)    return NS_ERROR_NULL_POINTER;  nsCOMPtr<nsPresContext> presContext;  rv = tracker->GetPresContext(getter_AddRefs(presContext));  if (NS_FAILED(rv))    return rv;  if (!presContext)    return NS_ERROR_NULL_POINTER;    nsIPresShell *shell = presContext->GetPresShell();  mPresShellWeak = do_GetWeakReference(shell);    // the presshell owns us, so no addref  if (mPresShellWeak)    NS_ADDREF(*aPresShell = shell);  return rv;}