mPresContext = aPresContext;
nsObjectFrame::Init(nsIPresContext*  aPresContext,                    nsIContent*      aContent,                    nsIFrame*        aParent,                    nsIStyleContext* aContext,                    nsIFrame*        aPrevInFlow){  nsresult rv = nsObjectFrameSuper::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);  if(rv != NS_OK)    return rv;  mPresContext = aPresContext; // weak ref  PRBool bImage = PR_FALSE;  //Ideally should be call to imlib, when it is available  // and even move this code to Reflow when the stream starts to come  IsSupportedImage(aContent, &bImage);    if(bImage)  {    nsCOMPtr<nsIPresShell> shell;    aPresContext->GetShell(getter_AddRefs(shell));    nsIFrame * aNewFrame = nsnull;    rv = NS_NewImageFrame(shell, &aNewFrame);    if(rv != NS_OK)      return rv;    rv = aNewFrame->Init(aPresContext, aContent, this, aContext, aPrevInFlow);    if(rv == NS_OK)    {      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;    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;}