return NS_ERROR_NO_INTERFACE;
if (content) { nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(content)); if (receiver) { nsCOMPtr<nsIDOMMouseListener> mouseListener; QueryInterface(NS_GET_IID(nsIDOMMouseListener), getter_AddRefs(mouseListener)); if (mouseListener) { receiver->AddEventListenerByIID(mouseListener, NS_GET_IID(nsIDOMMouseListener)); }  nsCOMPtr<nsIDOMMouseMotionListener> mouseMotionListener; QueryInterface(NS_GET_IID(nsIDOMMouseMotionListener), getter_AddRefs(mouseMotionListener)); if (mouseMotionListener) { receiver->AddEventListenerByIID(mouseMotionListener, NS_GET_IID(nsIDOMMouseMotionListener)); } } }   if (content) { nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(content)); if (receiver) { nsCOMPtr<nsIDOMKeyListener> keyListener; QueryInterface(NS_GET_IID(nsIDOMKeyListener), getter_AddRefs(keyListener)); if (keyListener) { receiver->AddEventListener(NS_LITERAL_STRING("keypress"), keyListener, PR_TRUE); receiver->AddEventListener(NS_LITERAL_STRING("keydown"), keyListener, PR_TRUE); receiver->AddEventListener(NS_LITERAL_STRING("keyup"), keyListener, PR_TRUE); } } }   if (mContext) { nsCOMPtr<nsIPresShell> presShell; mContext->GetShell(getter_AddRefs(presShell)); if (presShell) { nsCOMPtr<nsIViewManager> vm; presShell->GetViewManager(getter_AddRefs(vm)); if (vm) { nsIScrollableView* scrollingView = nsnull; vm->GetRootScrollableView(&scrollingView); if (scrollingView) { scrollingView->AddScrollPositionListener((nsIScrollPositionListener *)this); } } } }  return NS_OK;
nsresult nsPluginDOMContextMenuListener::Init(nsObjectFrame *aFrame){  nsCOMPtr<nsIContent> content;  aFrame->GetContent(getter_AddRefs(content));  // Register context menu listener  if (content) {    nsCOMPtr<nsIDOMEventReceiver> 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;}