mDocument->GetScriptLoader(getter_AddRefs(loader));
loader = mDocument->GetScriptLoader();
HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode){  nsresult rv = NS_OK;  // Create content object  NS_ASSERTION(mCurrentContext->mStackPos > 0, "leaf w/o container");  if (mCurrentContext->mStackPos <= 0) {    return NS_ERROR_FAILURE;  }  // Inserting the element into the document may execute a script.  // This can potentially make the parent go away. So, hold  // on to it till we are done.  nsCOMPtr<nsIHTMLContent> parent =    mCurrentContext->mStack[mCurrentContext->mStackPos - 1].mContent;  nsCOMPtr<nsIHTMLContent> element;  nsCOMPtr<nsINodeInfo> nodeInfo;  mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::script, nsnull, kNameSpaceID_None,                                getter_AddRefs(nodeInfo));  rv = NS_CreateHTMLElement(getter_AddRefs(element), nodeInfo, PR_FALSE);  if (NS_FAILED(rv)) {    return rv;  }  PRInt32 id;  mDocument->GetAndIncrementContentID(&id);  element->SetContentID(id);  // Add in the attributes and add the style content object to the  // head container.  element->SetDocument(mDocument, PR_FALSE, PR_TRUE);  rv = AddAttributes(aNode, element);  if (NS_FAILED(rv)) {    return rv;  }  nsCOMPtr<nsIDTD> dtd;  mParser->GetDTD(getter_AddRefs(dtd));  NS_ENSURE_TRUE(dtd, NS_ERROR_FAILURE);  nsCOMPtr<nsIScriptElement> sele(do_QueryInterface(element));  nsAutoString script;  PRInt32 lineNo = 0;  dtd->CollectSkippedContent(eHTMLTag_script, script, lineNo);  if (sele) {    sele->SetLineNumber((PRUint32)lineNo);  }  // Create a text node holding the content. First, get the text  // content of the script tag  if (!script.IsEmpty()) {    nsCOMPtr<nsITextContent> text;    rv = NS_NewTextNode(getter_AddRefs(text));    NS_ENSURE_SUCCESS(rv, rv);    text->SetText(script, PR_TRUE);    element->AppendChildTo(text, PR_FALSE, PR_FALSE);    text->SetDocument(mDocument, PR_FALSE, PR_TRUE);  }  nsCOMPtr<nsIScriptLoader> loader;  if (mFrameset) {    // Fix bug 82498    // We don't want to evaluate scripts in a frameset document.    if (mDocument) {      mDocument->GetScriptLoader(getter_AddRefs(loader));      if (loader) {        loader->SetEnabled(PR_FALSE);      }    }  } else {    // Don't include script loading and evaluation in the stopwatch    // that is measuring content creation time    MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::ProcessSCRIPTTag()\n"));    MOZ_TIMER_STOP(mWatch);    // Assume that we're going to block the parser with a script load.    // If it's an inline script, we'll be told otherwise in the call    // to our ScriptAvailable method.    mNeedToBlockParser = PR_TRUE;    nsCOMPtr<nsIDOMHTMLScriptElement> scriptElement = do_QueryInterface(element);    mScriptElements.AppendObject(scriptElement);  }  // Insert the child into the content tree. This will evaluate the  // script as well.  if (mCurrentContext->mStack[mCurrentContext->mStackPos - 1].mInsertionPoint != -1) {    parent->InsertChildAt(element,                          mCurrentContext->mStack[mCurrentContext->mStackPos - 1].mInsertionPoint++,                          PR_FALSE, PR_FALSE);  } else {    parent->AppendChildTo(element, PR_FALSE, PR_FALSE);  }  // To prevent script evaluation in a frameset document, we suspended  // the script loader. Now that the script content has been handled,  // let's resume the script loader.  if (loader) {    loader->SetEnabled(PR_TRUE);  }  // If the act of insertion evaluated the script, we're fine.  // Else, block the parser till the script has loaded.  if (mNeedToBlockParser || (mParser && !mParser->IsParserEnabled())) {    return NS_ERROR_HTMLPARSER_BLOCK;  }  return NS_OK;}