NS_ASSERTION(aFrame && aBGFrame, "illegal null parameter");
if (!aFrame || !aBGFrame) { NS_ERROR("illegal null parameter");
nsresult GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFrame, nsIFrame **aBGFrame){  NS_ASSERTION(aFrame && aBGFrame, "illegal null parameter");  nsresult rv = NS_OK;  if (aFrame && aBGFrame) {    *aBGFrame = aFrame; // default to the frame passed in    nsIContent* pContent = aFrame->GetContent();    if (pContent) {      // make sure that this is the HTML or BODY element      nsCOMPtr<nsIAtom> tag;      pContent->GetTag(getter_AddRefs(tag));      if (tag) {        if (tag.get() == nsHTMLAtoms::html ||            tag.get() == nsHTMLAtoms::body) {          // the frame is the body frame, so we provide the canvas frame          nsIFrame *pCanvasFrame = aFrame->GetParent();          while (pCanvasFrame) {            if (pCanvasFrame->GetType() == nsLayoutAtoms::canvasFrame) {              *aBGFrame = pCanvasFrame;              break;            }            pCanvasFrame = pCanvasFrame->GetParent();          }        }// if tag == html or body      }// if tag    }  } else {    rv = NS_ERROR_NULL_POINTER;  }  return rv;}