if (mPresContext) { mPresContext->SetContainer(nsnull); mPresContext->SetLinkHandler(nsnull); }
DocumentViewerImpl::~DocumentViewerImpl(){  if (mDocument) {    // Break global object circular reference on the document created    // in the DocViewer Init    nsCOMPtr<nsIScriptGlobalObject> globalObject;    mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));    if (globalObject) {      globalObject->SetNewDocument(nsnull);    }    // out of band cleanup of webshell    mDocument->SetScriptGlobalObject(nsnull);  }  if (mDeviceContext)    mDeviceContext->FlushFontCache();  if (mPresShell) {    // Break circular reference (or something)    mPresShell->EndObservingDocument();  }}