NS_ASSERTION(mCurrentContext != nsnull," Non-existing context");
if (mCurrentContext == 0) { return NS_ERROR_FAILURE; }
HTMLContentSink::BeginContext(PRInt32 aPosition){  MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::BeginContext()\n"));  MOZ_TIMER_START(mWatch);  NS_PRECONDITION(aPosition > -1, "out of bounds");  // Create new context  SinkContext* sc = new SinkContext(this);  if (nsnull == sc) {    MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::BeginContext()\n"));    MOZ_TIMER_STOP(mWatch);    return NS_ERROR_OUT_OF_MEMORY;  }     NS_ASSERTION(mCurrentContext != nsnull," Non-existing context");    // Flush everything in the current context so that we don't have  // to worry about insertions resulting in inconsistent frame creation.  mCurrentContext->FlushTags();  PRInt32 insertionPoint = -1;  nsHTMLTag nodeType      = mCurrentContext->mStack[aPosition].mType;  nsIHTMLContent* content = mCurrentContext->mStack[aPosition].mContent;  // If the content under which the new context is created  // has a child on the stack, the insertion point is  // before the last child.  if (aPosition < (mCurrentContext->mStackPos-1)) {    content->ChildCount(insertionPoint);    insertionPoint--;  }  sc->Begin(nodeType,            content,            mCurrentContext->mStack[aPosition].mNumFlushed,            insertionPoint);  NS_ADDREF(sc->mSink);  mContextStack.AppendElement(mCurrentContext);  mCurrentContext = sc;  MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::BeginContext()\n"));  MOZ_TIMER_STOP(mWatch);  return NS_OK;}