nsCOMPtr<nsIDOMContextMenuListener> cxMenuListener; QueryInterface(NS_GET_IID(nsIDOMContextMenuListener), getter_AddRefs(cxMenuListener)); if (cxMenuListener) { receiver->RemoveEventListenerByIID(cxMenuListener, NS_GET_IID(nsIDOMContextMenuListener));
nsCOMPtr<nsIDOMFocusListener> focusListener; QueryInterface(NS_GET_IID(nsIDOMFocusListener), getter_AddRefs(focusListener)); if (focusListener) { receiver->RemoveEventListenerByIID(focusListener, NS_GET_IID(nsIDOMFocusListener)); } else NS_ASSERTION(PR_FALSE, "Unable to remove event listener for plugin"); } else NS_ASSERTION(PR_FALSE, "plugin was not an event listener"); } else NS_ASSERTION(PR_FALSE, "plugin had no content");   if (content) { nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(content)); if (receiver) { nsCOMPtr<nsIDOMMouseListener> mouseListener; QueryInterface(NS_GET_IID(nsIDOMMouseListener), getter_AddRefs(mouseListener)); if (mouseListener) { receiver->RemoveEventListenerByIID(mouseListener, NS_GET_IID(nsIDOMMouseListener)); } else NS_ASSERTION(PR_FALSE, "Unable to remove event listener for plugin");  nsCOMPtr<nsIDOMMouseMotionListener> mouseMotionListener; QueryInterface(NS_GET_IID(nsIDOMMouseMotionListener), getter_AddRefs(mouseMotionListener)); if (mouseMotionListener) { receiver->RemoveEventListenerByIID(mouseMotionListener, NS_GET_IID(nsIDOMMouseMotionListener)); } else NS_ASSERTION(PR_FALSE, "Unable to remove event listener for plugin"); } else NS_ASSERTION(PR_FALSE, "plugin was not an event listener"); } else NS_ASSERTION(PR_FALSE, "plugin had no content");   if (content) { nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(content)); if (receiver) { nsCOMPtr<nsIDOMKeyListener> keyListener; QueryInterface(NS_GET_IID(nsIDOMKeyListener), getter_AddRefs(keyListener)); if (keyListener) { receiver->RemoveEventListener(NS_LITERAL_STRING("keypress"), keyListener, PR_TRUE); receiver->RemoveEventListener(NS_LITERAL_STRING("keydown"), keyListener, PR_TRUE); receiver->RemoveEventListener(NS_LITERAL_STRING("keyup"), keyListener, PR_TRUE);
nsresult nsPluginDOMContextMenuListener::Destroy(nsObjectFrame *aFrame){  nsCOMPtr<nsIContent> content;  aFrame->GetContent(getter_AddRefs(content));  // Unregister 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->RemoveEventListenerByIID(cxMenuListener, NS_GET_IID(nsIDOMContextMenuListener));      }      else NS_ASSERTION(PR_FALSE, "Unable to remove event listener for plugin");    }    else NS_ASSERTION(PR_FALSE, "plugin was not an event listener");  }  else NS_ASSERTION(PR_FALSE, "plugin had no content");  return NS_OK;}