if (IsInDoc()) { nsIPresShell *presShell = GetOwnerDoc()->GetShellAt(0);
nsIDocument* doc = GetCurrentDoc(); if (doc) { nsIPresShell *presShell = doc->GetShellAt(0);
nsSVGScriptElement::ScriptEvaluated(nsresult aResult,                                    nsIScriptElement *aElement,                                    PRBool aIsInline,                                    PRBool aWasPending){  nsresult rv = NS_OK;  if (!aIsInline) {    nsCOMPtr<nsPresContext> presContext;    if (IsInDoc()) {      nsIPresShell *presShell = GetOwnerDoc()->GetShellAt(0);      if (presShell)        presContext = presShell->GetPresContext();    }    nsEventStatus status = nsEventStatus_eIgnore;    nsEvent event(NS_SUCCEEDED(aResult) ? NS_SCRIPT_LOAD : NS_SCRIPT_ERROR);    rv = HandleDOMEvent(presContext, &event, nsnull, NS_EVENT_FLAG_INIT,                        &status);  }  return rv;}