NS_RELEASE(cx);
GetPresShellFor(nsIDocShell* aDocShell){  nsIPresShell* shell = nsnull;  if (nsnull != aDocShell) {    nsIContentViewer* cv = nsnull;    aDocShell->GetContentViewer(&cv);    if (nsnull != cv) {      nsIDocumentViewer* docv = nsnull;      cv->QueryInterface(kIDocumentViewerIID, (void**) &docv);      if (nsnull != docv) {        nsIPresContext* cx;        docv->GetPresContext(cx);        if (nsnull != cx) {          cx->GetShell(&shell);          NS_RELEASE(cx);        }        NS_RELEASE(docv);      }      NS_RELEASE(cv);    }  }  return shell;}