SinkContext::AddComment(const nsIParserNode& aNode) { SINK_TRACE_NODE(SINK_TRACE_CALLS, "SinkContext::AddLeaf", aNode, mStackPos, mSink);  nsIContent *comment; nsIDOMComment *domComment; nsresult result = NS_OK;  FlushTextAndRelease();  result = NS_NewCommentNode(&comment); if (NS_OK == result) { result = comment->QueryInterface(NS_GET_IID(nsIDOMComment), (void **)&domComment); if (NS_OK == result) { domComment->AppendData(aNode.GetText()); NS_RELEASE(domComment);  comment->SetDocument(mSink->mDocument, PR_FALSE, PR_TRUE);  nsIHTMLContent* parent; if ((nsnull == mSink->mBody) && (nsnull != mSink->mHead)) { parent = mSink->mHead; } else { parent = mStack[mStackPos - 1].mContent; }   if (mStack[mStackPos-1].mInsertionPoint != -1) { parent->InsertChildAt(comment, mStack[mStackPos-1].mInsertionPoint++, PR_FALSE); } else { parent->AppendChildTo(comment, PR_FALSE); }  DidAddContent(comment, PR_FALSE);  #ifdef DEBUG if (mPreAppend && SINK_LOG_TEST(gSinkLogModuleInfo,SINK_ALWAYS_REFLOW)) { mSink->ForceReflow(); } #endif } NS_RELEASE(comment); }  return result;
nsresult HTMLContentSink::AddComment(const nsIParserNode& aNode) { MOZ_TIMER_DEBUGLOG(("Start: nsHTMLContentSink::AddComment()\n")); MOZ_TIMER_START(mWatch); nsresult rv = NS_OK; rv = mCurrentContext->AddComment(aNode); MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::AddComment()\n")); MOZ_TIMER_STOP(mWatch); return rv;
SinkContext::AddComment(const nsIParserNode& aNode){  SINK_TRACE_NODE(SINK_TRACE_CALLS,                  "SinkContext::AddLeaf", aNode, mStackPos, mSink);  nsIContent *comment;  nsIDOMComment *domComment;  nsresult result = NS_OK;  FlushTextAndRelease();  result = NS_NewCommentNode(&comment);  if (NS_OK == result) {    result = comment->QueryInterface(NS_GET_IID(nsIDOMComment),                                      (void **)&domComment);    if (NS_OK == result) {      domComment->AppendData(aNode.GetText());      NS_RELEASE(domComment);            comment->SetDocument(mSink->mDocument, PR_FALSE, PR_TRUE);            nsIHTMLContent* parent;      if ((nsnull == mSink->mBody) && (nsnull != mSink->mHead)) {        parent = mSink->mHead;      }      else {        parent = mStack[mStackPos - 1].mContent;      }      // If the parent has an insertion point, insert rather than      // append.      if (mStack[mStackPos-1].mInsertionPoint != -1) {        parent->InsertChildAt(comment,                               mStack[mStackPos-1].mInsertionPoint++,                               PR_FALSE);      }      else {        parent->AppendChildTo(comment, PR_FALSE);      }            DidAddContent(comment, PR_FALSE);#ifdef DEBUG      if (mPreAppend &&           SINK_LOG_TEST(gSinkLogModuleInfo,SINK_ALWAYS_REFLOW)) {        mSink->ForceReflow();      }#endif    }    NS_RELEASE(comment);  }    return result;}