NS_ASSERTION(!mDocument, "User did not call nsIContentViewer::Close"); if (mDocument) Close();  NS_ASSERTION(!mPresShell, "User did not call nsIContentViewer::Destroy"); if (mPresShell) Destroy();
DocumentViewerImpl::~DocumentViewerImpl(){  NS_ASSERTION(!mDocument, "User did not call nsIContentViewer::Close");  if (mDocument)    Close();  NS_ASSERTION(!mPresShell, "User did not call nsIContentViewer::Destroy");  if (mPresShell)    Destroy();  if (mPagePrintTimer != nsnull) {    mPagePrintTimer->Stop();    delete mPagePrintTimer;  }  if (mPrt != nsnull) {    mPrt->OnEndPrinting(NS_ERROR_FAILURE);    delete mPrt;  }  // XXX(?) Revoke pending invalidate events  // clear weak references before we go away  if (mPresContext) {    mPresContext->SetContainer(nsnull);    mPresContext->SetLinkHandler(nsnull);    // XXX This is only needed because bg images have not been    // converted to the new image lib.  Once pav does this, we    // can just remove this code.  Right now it is only here    // for background images.    // stop everything but the chrome.    mPresContext->Stop();  }}