receiver->RemoveEventListenerByIID(keyListener, NS_GET_IID(nsIDOMKeyListener));
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);
nsPluginInstanceOwner::Destroy(){  // Unregister mouse event listener  nsCOMPtr<nsIContent> content;  mOwner->GetContent(getter_AddRefs(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");    }    else NS_ASSERTION(PR_FALSE, "plugin was not an event listener");  }  else NS_ASSERTION(PR_FALSE, "plugin had no content");    // Unregister key event listener;  if (content) {    nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(content));    if (receiver) {      nsCOMPtr<nsIDOMKeyListener> keyListener;      QueryInterface(NS_GET_IID(nsIDOMKeyListener), getter_AddRefs(keyListener));      if (keyListener) {         receiver->RemoveEventListenerByIID(keyListener, NS_GET_IID(nsIDOMKeyListener));      }      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;}