nsIDocShell *docShell = sgo->GetDocShell();
nsIDocShell *docShell = win->GetDocShell();
nsSelectionCommandsBase::GetPresShellFromWindow(nsIDOMWindow *aWindow, nsIPresShell **aPresShell){  *aPresShell = nsnull;  nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(aWindow));  NS_ENSURE_TRUE(sgo, NS_ERROR_FAILURE);  nsIDocShell *docShell = sgo->GetDocShell();  NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);  return docShell->GetPresShell(aPresShell);}