if (content) { nsCOMPtr<nsIDOMEventTarget> receiver(do_QueryInterface(content)); if (receiver) { nsCOMPtr<nsIDOMContextMenuListener> cxMenuListener; QueryInterface(NS_GET_IID(nsIDOMContextMenuListener), getter_AddRefs(cxMenuListener)); if (cxMenuListener) { receiver->AddEventListener(NS_LITERAL_STRING("contextmenu"), cxMenuListener, PR_TRUE); return NS_OK;
nsCOMPtr<nsISupports> container = aPresContext->GetContainer(); if (container) {    nsCOMPtr<nsPIDOMWindow> privWindow = do_GetInterface(container); nsIFocusController *fc = nsnull; if (privWindow) { fc = privWindow->GetRootFocusController(); if (fc) fc->SetSuppressFocus(PR_TRUE, "PluginInstanceOwner::Init Suppression"); }  nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container); if (docShell) { nsCOMPtr<nsIContentViewer> cv; docShell->GetContentViewer(getter_AddRefs(cv));   nsCOMPtr<nsIDocumentViewer> docV(do_QueryInterface(cv)); if (docV) { nsCOMPtr<nsIPresContext> currentPresContext; docV->GetPresContext(getter_AddRefs(currentPresContext)); if (currentPresContext == aPresContext) { cv->Show(); }
nsresult nsPluginDOMContextMenuListener::Init(nsObjectFrame *aFrame){  nsIContent* content = aFrame->GetContent();  // Register context menu listener  if (content) {    nsCOMPtr<nsIDOMEventTarget> receiver(do_QueryInterface(content));    if (receiver) {      nsCOMPtr<nsIDOMContextMenuListener> cxMenuListener;      QueryInterface(NS_GET_IID(nsIDOMContextMenuListener), getter_AddRefs(cxMenuListener));      if (cxMenuListener) {        receiver->AddEventListener(NS_LITERAL_STRING("contextmenu"), cxMenuListener, PR_TRUE);        return NS_OK;      }    }  }  return NS_ERROR_NO_INTERFACE;}