nsCOMPtr<nsPIDOMWindow> privateWin(do_QueryInterface(document->GetScriptGlobalObject(), &rv)); NS_ENSURE_SUCCESS(rv, rv);
nsPIDOMWindow *privateWin = document->GetWindow(); NS_ENSURE_TRUE(privateWin, NS_ERROR_NOT_AVAILABLE);
DocumentViewerImpl::GetPopupNode(nsIDOMNode** aNode){  NS_ENSURE_ARG_POINTER(aNode);  nsresult rv;  // get the document  nsCOMPtr<nsIDocument> document;  rv = GetDocument(getter_AddRefs(document));  NS_ENSURE_SUCCESS(rv, rv);  NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);  // get the private dom window  nsCOMPtr<nsPIDOMWindow> privateWin(do_QueryInterface(document->GetScriptGlobalObject(), &rv));  NS_ENSURE_SUCCESS(rv, rv);  // get the focus controller  nsIFocusController *focusController = privateWin->GetRootFocusController();  NS_ENSURE_TRUE(focusController, NS_ERROR_FAILURE);  // get the popup node  focusController->GetPopupNode(aNode); // addref happens here  return rv;}