nsresult rv;
nsresult rv = NS_OK;
DocumentViewerImpl::LoadComplete(nsresult aStatus){  nsresult rv;  nsCOMPtr<nsIScriptGlobalObject> global;  // First, get the script global object from the document...  if (mDocument) {    rv = mDocument->GetScriptGlobalObject(getter_AddRefs(global));  }  // Fail if no ScriptGlobalObject is available...  NS_ASSERTION(global, "nsIScriptGlobalObject not set for document!");  if (!global) return NS_ERROR_NULL_POINTER;  // Now, fire either an OnLoad or OnError event to the document...  if(NS_SUCCEEDED(aStatus)) {    nsEventStatus status = nsEventStatus_eIgnore;    nsEvent event;    event.eventStructType = NS_EVENT;    event.message = NS_PAGE_LOAD;    rv = global->HandleDOMEvent(mPresContext, &event, nsnull,                                NS_EVENT_FLAG_INIT, &status);  } else {    // XXX: Should fire error event to the document...  }  return rv;}