if (NS_SUCCEEDED(rv))
if(rv == NS_OK)
nsObjectFrame::Init(nsIPresContext*  aPresContext,                    nsIContent*      aContent,                    nsIFrame*        aParent,                    nsStyleContext*  aContext,                    nsIFrame*        aPrevInFlow){  nsresult rv = nsObjectFrameSuper::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);  if(rv != NS_OK)    return rv;  mPresContext = aPresContext; // weak ref  //Ideally this should move to Reflow when the stream starts to come  if (IsSupportedImage(aContent))  {    // kick off the image load in the content node    // XXX once this moves to somewhere where we have the data stream,    // we should have a way to load images with a channel....    nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(aContent);    if (!imageLoader) {      NS_ERROR("Not an image loading content?");      return NS_ERROR_UNEXPECTED;    }    nsCOMPtr<nsIAtom> tag;    aContent->GetTag(getter_AddRefs(tag));    nsAutoString data;        // If this is an OBJECT tag, we should look for a DATA attribute.    // If not, it's an EMBED tag, and so we should look for a SRC attribute.    if (tag == nsHTMLAtoms::object)      rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);    else      rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);        imageLoader->ImageURIChanged(data);        nsCOMPtr<nsIPresShell> shell;    aPresContext->GetShell(getter_AddRefs(shell));    nsIFrame * aNewFrame = nsnull;    rv = NS_NewImageFrame(shell, &aNewFrame);    if (NS_FAILED(rv))      return rv;    // XXX we're using the same style context for ourselves and the    // image frame.  If this ever changes, please fix HandleChild() to deal.    rv = aNewFrame->Init(aPresContext, aContent, this, aContext, aPrevInFlow);    if (NS_SUCCEEDED(rv))    {      nsHTMLContainerFrame::CreateViewForFrame(aPresContext, aNewFrame, aContext, nsnull, PR_FALSE);      mFrames.AppendFrame(this, aNewFrame);    }    else      aNewFrame->Destroy(aPresContext);    return rv; // bail at this point  }    // only do the following for the object tag  nsCOMPtr<nsIAtom> tag;  aContent->GetTag(getter_AddRefs(tag));  if (tag.get() != nsHTMLAtoms::object) return rv;  // for now, we should try to do the same for "document" types and create  // and IFrame-like sub-frame  PRBool bDoc = PR_FALSE;  IsSupportedDocument(aContent, &bDoc);  if(bDoc)  {    nsCOMPtr<nsIPresShell> shell;    aPresContext->GetShell(getter_AddRefs(shell));    nsIFrame * aNewFrame = nsnull;    rv = NS_NewHTMLFrameOuterFrame(shell, &aNewFrame);    if(NS_FAILED(rv))      return rv;    // XXX we're using the same style context for ourselves and the    // iframe.  If this ever changes, please fix HandleChild() to deal.    rv = aNewFrame->Init(aPresContext, aContent, this, aContext, aPrevInFlow);    if(NS_SUCCEEDED(rv))    {      nsHTMLContainerFrame::CreateViewForFrame(aPresContext, aNewFrame, aContext, nsnull, PR_FALSE);      mFrames.AppendFrame(this, aNewFrame);    }    else      aNewFrame->Destroy(aPresContext);  }  return rv;}