return NS_OK;
nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject){  if (!aScriptGlobalObject) {    if (mImageResizingEnabled) {      nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mImageElement);      target->RemoveEventListener(NS_LITERAL_STRING("click"), this, PR_FALSE);      target = do_QueryInterface(mScriptGlobalObject);      target->RemoveEventListener(NS_LITERAL_STRING("resize"), this, PR_FALSE);      target->RemoveEventListener(NS_LITERAL_STRING("keypress"), this,                                  PR_FALSE);    }    // drop the ref to mImageElement, in case it has a ref to us    mImageElement = nsnull;  }  // Set the script global object on the superclass before doing  // anything that might require it....  nsresult rv = nsHTMLDocument::SetScriptGlobalObject(aScriptGlobalObject);  if (NS_FAILED(rv)) {    return rv;  }  if (aScriptGlobalObject) {    // Create synthetic document    rv = CreateSyntheticDocument();    if (NS_FAILED(rv)) {      return rv;    }    if (mImageResizingEnabled) {      nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mImageElement);      target->AddEventListener(NS_LITERAL_STRING("click"), this, PR_FALSE);      target = do_QueryInterface(aScriptGlobalObject);      target->AddEventListener(NS_LITERAL_STRING("resize"), this, PR_FALSE);      target->AddEventListener(NS_LITERAL_STRING("keypress"), this, PR_FALSE);    }  }  return NS_OK;}