nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType()); nsIHTMLContent* content; rv = mSink->CreateContentObject(aNode, nodeType, mSink->mCurrentForm, mSink->mFrameset ? mSink->mWebShell : nsnull, &content); if (NS_OK != rv) { return rv; }  nsresult srv; nsCOMPtr<nsISelectElement> select = do_QueryInterface(content, &srv); if (NS_SUCCEEDED(srv)) { srv = select->DoneAddingContent(PR_FALSE); }  mStack[mStackPos].mType = nodeType; mStack[mStackPos].mContent = content; mStack[mStackPos].mFlags = 0; mStack[mStackPos].mNumFlushed = 0; mStack[mStackPos].mInsertionPoint = -1; content->SetDocument(mSink->mDocument, PR_FALSE, PR_TRUE);  nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject; mSink->mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject)); rv = mSink->AddAttributes(aNode, content);  if (mPreAppend) { NS_ASSERTION(mStackPos > 0, "container w/o parent"); if (mStackPos <= 0) { return NS_ERROR_FAILURE; } nsIHTMLContent* parent = mStack[mStackPos-1].mContent; if (mStack[mStackPos-1].mInsertionPoint != -1) { parent->InsertChildAt(content, mStack[mStackPos-1].mInsertionPoint++, PR_FALSE); } else { parent->AppendChildTo(content, PR_FALSE); } mStack[mStackPos].mFlags |= APPENDED; } mStackPos++; if (NS_OK != rv) { return rv; }  if (mSink->IsMonolithicContainer(nodeType)) { mSink->mInMonolithicContainer++; }   switch (nodeType) {  case eHTMLTag_noembed: case eHTMLTag_noframes: case eHTMLTag_noscript: mSink->mInsideNoXXXTag++; break;  case eHTMLTag_a: mSink->ProcessATag(aNode, content); break; case eHTMLTag_table: case eHTMLTag_thead: case eHTMLTag_tbody: case eHTMLTag_tfoot: case eHTMLTag_tr: case eHTMLTag_td: case eHTMLTag_th:  mSink->AddBaseTagInfo(content); break; case eHTMLTag_map: mSink->ProcessMAPTag(aNode, content); break; case eHTMLTag_iframe: mSink->mNumOpenIFRAMES++; break; default: break; }  return NS_OK;
rv = mCurrentContext->OpenContainer(aNode); MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::OpenContainer()\n")); MOZ_TIMER_STOP(mWatch); return rv;
SinkContext::OpenContainer(const nsIParserNode& aNode){  FlushTextAndRelease();  SINK_TRACE_NODE(SINK_TRACE_CALLS,                  "SinkContext::OpenContainer", aNode, mStackPos, mSink);  nsresult rv;  if (mStackPos + 1 > mStackSize) {    rv = GrowStack();    if (NS_OK != rv) {      return rv;    }  }  // Create new container content object  nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());  nsIHTMLContent* content;  rv = mSink->CreateContentObject(aNode, nodeType,                                  mSink->mCurrentForm,                                  mSink->mFrameset ? mSink->mWebShell : nsnull,                                  &content);  if (NS_OK != rv) {    return rv;  }  nsresult srv;  nsCOMPtr<nsISelectElement> select = do_QueryInterface(content, &srv);  if (NS_SUCCEEDED(srv)) {    srv = select->DoneAddingContent(PR_FALSE);  }  mStack[mStackPos].mType = nodeType;  mStack[mStackPos].mContent = content;  mStack[mStackPos].mFlags = 0;  mStack[mStackPos].mNumFlushed = 0;  mStack[mStackPos].mInsertionPoint = -1;  content->SetDocument(mSink->mDocument, PR_FALSE, PR_TRUE);    nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;  mSink->mDocument->GetScriptGlobalObject(getter_AddRefs(scriptGlobalObject));  rv = mSink->AddAttributes(aNode, content);  if (mPreAppend) {    NS_ASSERTION(mStackPos > 0, "container w/o parent");    if (mStackPos <= 0) {      return NS_ERROR_FAILURE;    }    nsIHTMLContent* parent = mStack[mStackPos-1].mContent;    if (mStack[mStackPos-1].mInsertionPoint != -1) {      parent->InsertChildAt(content,                             mStack[mStackPos-1].mInsertionPoint++,                             PR_FALSE);    }    else {      parent->AppendChildTo(content, PR_FALSE);    }    mStack[mStackPos].mFlags |= APPENDED;  }  mStackPos++;  if (NS_OK != rv) {    return rv;  }  if (mSink->IsMonolithicContainer(nodeType)) {      mSink->mInMonolithicContainer++;  }      // Special handling for certain tags  switch (nodeType) {    case eHTMLTag_noembed:    case eHTMLTag_noframes:    case eHTMLTag_noscript:      mSink->mInsideNoXXXTag++;      break;    case eHTMLTag_a:      mSink->ProcessATag(aNode, content);      break;    case eHTMLTag_table:    case eHTMLTag_thead:    case eHTMLTag_tbody:    case eHTMLTag_tfoot:    case eHTMLTag_tr:    case eHTMLTag_td:    case eHTMLTag_th:      // XXX if navigator_quirks_mode (only body in html supports background)      mSink->AddBaseTagInfo(content);           break;    case eHTMLTag_map:      mSink->ProcessMAPTag(aNode, content);      break;    case eHTMLTag_iframe:      mSink->mNumOpenIFRAMES++;      break;    default:      break;  }  return NS_OK;}