NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(GetPresShell(getter_AddRefs(presShell)), NS_ERROR_FAILURE);
NS_IMETHODIMP DocumentViewerImpl::ScrollToNode(nsIDOMNode* aNode){   NS_ENSURE_ARG(aNode);   NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);   nsCOMPtr<nsIPresShell> presShell;   NS_ENSURE_SUCCESS(GetPresShell(*(getter_AddRefs(presShell))), NS_ERROR_FAILURE);   // Get the nsIContent interface, because that's what we need to   // get the primary frame   nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));   NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);   // Get the primary frame   nsIFrame* frame;  // Remember Frames aren't ref-counted.  They are in their                     // own special little world.   NS_ENSURE_SUCCESS(presShell->GetPrimaryFrameFor(content, &frame),      NS_ERROR_FAILURE);   // tell the pres shell to scroll to the frame   NS_ENSURE_SUCCESS(presShell->ScrollFrameIntoView(frame,                                                    NS_PRESSHELL_SCROLL_TOP,                                                    NS_PRESSHELL_SCROLL_ANYWHERE),                     NS_ERROR_FAILURE);   return NS_OK;}