nsCOMPtr<nsIScriptGlobalObject> global;
nsCOMPtr<nsIScriptGlobalObject> global = mDocument->GetScriptGlobalObject();
DocumentViewerImpl::Unload(){  mEnableRendering = PR_FALSE;  if (!mDocument) {    return NS_ERROR_NULL_POINTER;  }  // First, get the script global object from the document...  nsCOMPtr<nsIScriptGlobalObject> global;  nsresult rv = mDocument->GetScriptGlobalObject(getter_AddRefs(global));  if (!global) {    // Fail if no ScriptGlobalObject is available...    NS_ASSERTION(0, "nsIScriptGlobalObject not set for document!");    return NS_ERROR_NULL_POINTER;  }  // Now, fire an Unload event to the document...  nsEventStatus status = nsEventStatus_eIgnore;  nsEvent event;  event.eventStructType = NS_EVENT;  event.message = NS_PAGE_UNLOAD;  rv = global->HandleDOMEvent(mPresContext, &event, nsnull,                              NS_EVENT_FLAG_INIT, &status);  return rv;}