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->RemoveScrollPositionListener((nsIScrollPositionListener *)this); } } } }  mOwner = nsnull;
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;}