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