Bug 720650 - Remove nsLoggingSink. r=mrbkap.
authorHenri Sivonen <hsivonen@iki.fi>
Tue, 24 Jan 2012 13:02:50 +0200
changeset 86439 30f32ca8241ae46acadb60e215c99de90372882a
parent 86418 117f6d70c5848da872fae33c03702158e126adc0
child 86440 5200b73a4e4e7ab268327da8ae508053d4d76ae1
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs720650
milestone12.0a1
Bug 720650 - Remove nsLoggingSink. r=mrbkap.
parser/htmlparser/public/Makefile.in
parser/htmlparser/public/nsILoggingSink.h
parser/htmlparser/src/CNavDTD.cpp
parser/htmlparser/src/Makefile.in
parser/htmlparser/src/nsLoggingSink.cpp
parser/htmlparser/src/nsLoggingSink.h
parser/htmlparser/src/nsParserModule.cpp
--- a/parser/htmlparser/public/Makefile.in
+++ b/parser/htmlparser/public/Makefile.in
@@ -65,17 +65,11 @@ EXPORTS = \
 		nsHTMLTokens.h              \
 		nsScannerString.h           \
 		nsParserCIID.h              \
 		nsToken.h                   \
 		nsParserConstants.h         \
 		nsParserBase.h             \
 		$(NULL)
 
-ifdef MOZ_DEBUG
-EXPORTS += \
-		nsILoggingSink.h \
-		$(NULL)
-endif
-
 EXPORTS   := $(addprefix $(srcdir)/, $(EXPORTS))
 
 include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/parser/htmlparser/public/nsILoggingSink.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#ifndef nsILoggingSink_h___
-#define nsILoggingSink_h___
-
-#include "nsIHTMLContentSink.h"
-#include "nsStringGlue.h"
-#include "prprf.h"
-
-// IID for nsILoggingSink
-#define NS_ILOGGING_SINK_IID \
- {0xa6cf9061, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-
-class nsILoggingSink : public nsIHTMLContentSink {
-public:
-  NS_IMETHOD SetOutputStream(PRFileDesc *aStream,bool autoDelete=false) =0;
-};
-
-extern "C" nsresult NS_NewHTMLLoggingSink(nsIContentSink** aInstancePtrResult);
-
-#endif /* nsILoggingSink_h___ */
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -58,20 +58,16 @@
 #include "nsIFormProcessor.h"
 #include "nsTArray.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "prmem.h"
 #include "nsIServiceManager.h"
 #include "nsParserConstants.h"
 
-#ifdef NS_DEBUG
-#include "nsLoggingSink.h"
-#endif
-
 using namespace mozilla;
 
 /*
  * Ignore kFontStyle and kPhrase tags when the stack is deep, bug 58917.
  */
 #define FONTSTYLE_IGNORE_DEPTH (MAX_REFLOW_DEPTH * 80 / 100)
 #define PHRASE_IGNORE_DEPTH    (MAX_REFLOW_DEPTH * 90 / 100)
 
@@ -123,64 +119,20 @@ CNavDTD::CNavDTD()
     mParserCommand(eViewNormal),
     mLineNumber(1),
     mOpenMapCount(0),
     mHeadContainerPosition(-1),
     mFlags(NS_DTD_FLAG_NONE)
 {
 }
 
-#ifdef NS_DEBUG
-
-static nsLoggingSink*
-GetLoggingSink()
-{
-  // This returns a content sink that is useful for following what calls the DTD
-  // makes to the content sink.
-
-  static bool checkForPath = true;
-  static nsLoggingSink *theSink = nsnull;
-  static const char* gLogPath = nsnull; 
-
-  if (checkForPath) {
-    // Only check once per run.
-    gLogPath = PR_GetEnv("PARSE_LOGFILE"); 
-    checkForPath = false;
-  }
-  
-
-  if (gLogPath && !theSink) {
-    static nsLoggingSink gLoggingSink;
-
-    PRIntn theFlags = PR_CREATE_FILE | PR_RDWR;
-
-    // Open the record file.
-    PRFileDesc *theLogFile = PR_Open(gLogPath, theFlags, 0);
-    gLoggingSink.SetOutputStream(theLogFile, true);
-    theSink = &gLoggingSink;
-  }
-
-  return theSink;
-}
- 
-#endif
-
 CNavDTD::~CNavDTD()
 {
   delete mBodyContext;
   delete mTempContext;
-
-#ifdef NS_DEBUG
-  if (mSink) {
-    nsLoggingSink *theLogSink = GetLoggingSink();
-    if (mSink == theLogSink) {
-      theLogSink->ReleaseProxySink();
-    }
-  }
-#endif
 }
 
 NS_IMETHODIMP
 CNavDTD::WillBuildModel(const CParserContext& aParserContext,
                         nsITokenizer* aTokenizer,
                         nsIContentSink* aSink)
 {
   nsresult result = NS_OK;
@@ -200,27 +152,16 @@ CNavDTD::WillBuildModel(const CParserCon
     if (!mSink) {
       mSink = do_QueryInterface(aSink, &result);
       if (NS_FAILED(result)) {
         mFlags |= NS_DTD_FLAG_STOP_PARSING;
         return result;
       }
     }
 
-    // Let's see if the environment is set up for us to write output to
-    // a logging sink. If so, then we'll create one, and make it the
-    // proxy for the real sink we're given from the parser.
-#ifdef NS_DEBUG
-    nsLoggingSink *theLogSink = GetLoggingSink();
-    if (theLogSink) {
-      theLogSink->SetProxySink(mSink);
-      mSink = theLogSink;
-    }
-#endif    
-
     mFlags |= nsHTMLTokenizer::GetFlags(aSink);
 
   }
 
   return result;
 }
 
 NS_IMETHODIMP
--- a/parser/htmlparser/src/Makefile.in
+++ b/parser/htmlparser/src/Makefile.in
@@ -71,17 +71,11 @@ CPPSRCS = \
 		nsParserService.cpp \
 		nsParserModule.cpp  \
 		nsParserNode.cpp    \
 		nsScanner.cpp       \
 		nsToken.cpp         \
 		nsParserMsgUtils.cpp\
 		$(NULL)
 
-ifdef MOZ_DEBUG
-CPPSRCS += \
-		nsLoggingSink.cpp   \
-		$(NULL)
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/io
deleted file mode 100644
--- a/parser/htmlparser/src/nsLoggingSink.cpp
+++ /dev/null
@@ -1,539 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=2 et tw=78: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#include "nsIAtom.h"
-#include "nsLoggingSink.h"
-#include "nsHTMLTags.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "prprf.h"
-
-
-static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID);
-static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
-static NS_DEFINE_IID(kILoggingSinkIID, NS_ILOGGING_SINK_IID);
-static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
-
-nsresult
-NS_NewHTMLLoggingSink(nsIContentSink** aInstancePtrResult)
-{
-  NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
-  if (nsnull == aInstancePtrResult) {
-    return NS_ERROR_NULL_POINTER;
-  }
-  nsLoggingSink* it = new nsLoggingSink();
-  if (nsnull == it) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-  return it->QueryInterface(kIContentSinkIID, (void**) aInstancePtrResult);
-}
-
-nsLoggingSink::nsLoggingSink() {
-  mOutput = 0;
-  mLevel=-1;
-  mSink=0;
-}
-
-nsLoggingSink::~nsLoggingSink() { 
-  mSink=0;
-  if(mOutput && mAutoDeleteOutput) {
-    delete mOutput;
-  }
-  mOutput=0;
-}
-
-NS_IMPL_ISUPPORTS3(nsLoggingSink, nsILoggingSink, nsIContentSink, nsIHTMLContentSink)
-
-NS_IMETHODIMP
-nsLoggingSink::SetOutputStream(PRFileDesc *aStream,bool autoDeleteOutput) {
-  mOutput = aStream;
-  mAutoDeleteOutput=autoDeleteOutput;
-  return NS_OK;
-}
-
-static
-void WriteTabs(PRFileDesc * out,int aTabCount) {
-  int tabs;
-  for(tabs=0;tabs<aTabCount;++tabs)
-    PR_fprintf(out, "  ");
-}
-
-NS_IMETHODIMP
-nsLoggingSink::WillParse() {
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsLoggingSink::WillBuildModel(nsDTDMode aDTDMode) {
-  
-  WriteTabs(mOutput,++mLevel);
-  PR_fprintf(mOutput, "<begin>\n");
-  
-  //proxy the call to the real sink if you have one.
-  if(mSink) {
-    mSink->WillBuildModel(aDTDMode);
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsLoggingSink::DidBuildModel(bool aTerminated) {
-  
-  WriteTabs(mOutput,--mLevel);
-  PR_fprintf(mOutput, "</begin>\n");
-
-  //proxy the call to the real sink if you have one.
-  nsresult theResult=NS_OK;
-  if(mSink) {
-    theResult=mSink->DidBuildModel(aTerminated);
-  }
-
-  return theResult;
-}
-
-NS_IMETHODIMP
-nsLoggingSink::WillInterrupt() {
-  nsresult theResult=NS_OK;
-
-  //proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->WillInterrupt();
-  }
-  
-  return theResult;
-}
-
-NS_IMETHODIMP
-nsLoggingSink::WillResume() {
-  nsresult theResult=NS_OK;
-
-  //proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->WillResume();
-  }
-  
-  return theResult;
-}
-
-NS_IMETHODIMP
-nsLoggingSink::SetParser(nsParserBase* aParser)  {
-  nsresult theResult=NS_OK;
-
-  //proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->SetParser(aParser);
-  }
-  
-  return theResult;
-}
-
-NS_IMETHODIMP
-nsLoggingSink::OpenContainer(const nsIParserNode& aNode) {
-
-  OpenNode("container", aNode); //do the real logging work...
-
-  nsresult theResult=NS_OK;
-
-  //then proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->OpenContainer(aNode);
-  }
-  
-  return theResult;
-
-}
-
-NS_IMETHODIMP
-nsLoggingSink::CloseContainer(const nsHTMLTag aTag) {
-
-  nsresult theResult=NS_OK;
-
-  nsHTMLTag nodeType = nsHTMLTag(aTag);
-  if ((nodeType >= eHTMLTag_unknown) &&
-      (nodeType <= nsHTMLTag(NS_HTML_TAG_MAX))) {
-    const PRUnichar* tag = nsHTMLTags::GetStringValue(nodeType);
-    theResult = CloseNode(NS_ConvertUTF16toUTF8(tag).get());
-  }
-  else theResult= CloseNode("???");
-
-  //then proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->CloseContainer(aTag);
-  }
-  
-  return theResult;
-
-}
-
-NS_IMETHODIMP
-nsLoggingSink::AddLeaf(const nsIParserNode& aNode) {
-  LeafNode(aNode);
-
-  nsresult theResult=NS_OK;
-
-  //then proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->AddLeaf(aNode);
-  }
-  
-  return theResult;
-
-} 
-
-/**
- *  This gets called by the parser when you want to add
- *  a PI node to the current container in the content
- *  model.
- *  
- *  @updated gess 3/25/98
- *  @param   
- *  @return  
- */
-NS_IMETHODIMP
-nsLoggingSink::AddProcessingInstruction(const nsIParserNode& aNode){
-
-#ifdef VERBOSE_DEBUG
-  DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
-#endif
-
-  nsresult theResult=NS_OK;
-
-  //then proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->AddProcessingInstruction(aNode);
-  }
-  
-  return theResult;
-}
-
-/**
- *  This gets called by the parser when it encounters
- *  a DOCTYPE declaration in the HTML document.
- */
-
-NS_IMETHODIMP
-nsLoggingSink::AddDocTypeDecl(const nsIParserNode& aNode) {
-
-#ifdef VERBOSE_DEBUG
-  DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
-#endif
-
-  nsresult theResult=NS_OK;
-
-  //then proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->AddDocTypeDecl(aNode);
-  }
-  
-  return theResult;
-
-}
-
-/**
- *  This gets called by the parser when you want to add
- *  a comment node to the current container in the content
- *  model.
- *  
- *  @updated gess 3/25/98
- *  @param   
- *  @return  
- */
-NS_IMETHODIMP
-nsLoggingSink::AddComment(const nsIParserNode& aNode){
-
-#ifdef VERBOSE_DEBUG
-  DebugDump("<",aNode.GetText(),(mNodeStackPos)*2);
-#endif
-
-  nsresult theResult=NS_OK;
-
-  //then proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->AddComment(aNode);
-  }
-  
-  return theResult;
-
-}
-
-NS_IMETHODIMP
-nsLoggingSink::OpenHead() {
-  WriteTabs(mOutput,++mLevel);
-  PR_fprintf(mOutput,"<open container=head>\n");
-
-  nsresult theResult=NS_OK;
-
-  //then proxy the call to the real sink if you have one.
-  if(mSink) {
-    theResult=mSink->OpenHead();
-  }
-  
-  return theResult;
-}
-
-nsresult
-nsLoggingSink::OpenNode(const char* aKind, const nsIParserNode& aNode) {
-	WriteTabs(mOutput,++mLevel);
-
-  PR_fprintf(mOutput,"<open container=");
-
-  nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
-  if ((nodeType >= eHTMLTag_unknown) &&
-      (nodeType <= nsHTMLTag(NS_HTML_TAG_MAX))) {
-    const PRUnichar* tag = nsHTMLTags::GetStringValue(nodeType);
-    PR_fprintf(mOutput, "\"%s\"", NS_ConvertUTF16toUTF8(tag).get());
-  }
-  else {
-    char* text = nsnull;
-    GetNewCString(aNode.GetText(), &text);
-    if(text) {
-      PR_fprintf(mOutput, "\"%s\"", text);
-      nsMemory::Free(text);
-    }
-  }
-
-  if (WillWriteAttributes(aNode)) {
-    PR_fprintf(mOutput, ">\n");
-    WriteAttributes(aNode);
-    PR_fprintf(mOutput, "</open>\n");
-  }
-  else {
-    PR_fprintf(mOutput, ">\n");
-  }
-
-  return NS_OK;
-}
-
-nsresult
-nsLoggingSink::CloseNode(const char* aKind) {
-	WriteTabs(mOutput,mLevel--);
-  PR_fprintf(mOutput, "<close container=\"%s\">\n", aKind);
-  return NS_OK;
-}
-
-
-nsresult
-nsLoggingSink::WriteAttributes(const nsIParserNode& aNode) {
-
-  WriteTabs(mOutput,1+mLevel);
-  nsAutoString tmp;
-  PRInt32 ac = aNode.GetAttributeCount();
-  for (PRInt32 i = 0; i < ac; ++i) {
-    char* key=nsnull;
-    char* value=nsnull;
-    const nsAString& k = aNode.GetKeyAt(i);
-    const nsAString& v = aNode.GetValueAt(i);
-
-    GetNewCString(k, &key);
-    if(key) {
-      PR_fprintf(mOutput, " <attr key=\"%s\" value=\"", key);
-      nsMemory::Free(key);
-    }
- 
-    tmp.Truncate();
-    tmp.Append(v);
-    if(!tmp.IsEmpty()) {
-      PRUnichar first = tmp.First();
-      if ((first == '"') || (first == '\'')) {
-        if (tmp.Last() == first) {
-          tmp.Cut(0, 1);
-          PRInt32 pos = tmp.Length() - 1;
-          if (pos >= 0) {
-            tmp.Cut(pos, 1);
-          }
-        } else {
-          // Mismatched quotes - leave them in
-        }
-      }
-      GetNewCString(tmp, &value);
-
-      if(value) {
-        PR_fprintf(mOutput, "%s\"/>\n", value);
-        WriteTabs(mOutput,1+mLevel);
-        nsMemory::Free(value);
-      }
-    }
-  }
-
-  WriteTabs(mOutput,1+mLevel);
-  return NS_OK;
-}
-
-bool
-nsLoggingSink::WillWriteAttributes(const nsIParserNode& aNode)
-{
-  PRInt32 ac = aNode.GetAttributeCount();
-  if (0 != ac) {
-    return true;
-  }
-  return false;
-}
-
-nsresult
-nsLoggingSink::LeafNode(const nsIParserNode& aNode)
-{
-  WriteTabs(mOutput,1+mLevel);
-  nsHTMLTag nodeType  = nsHTMLTag(aNode.GetNodeType());
-
-  if ((nodeType >= eHTMLTag_unknown) &&
-      (nodeType <= nsHTMLTag(NS_HTML_TAG_MAX))) {
-    const PRUnichar* tag = nsHTMLTags::GetStringValue(nodeType);
-
-    if(tag)
-      PR_fprintf(mOutput, "<leaf tag=\"%s\"", NS_ConvertUTF16toUTF8(tag).get());
-    else
-      PR_fprintf(mOutput, "<leaf tag=\"???\"");
-
-    if (WillWriteAttributes(aNode)) {
-      PR_fprintf(mOutput, ">\n");
-      WriteAttributes(aNode);
-      PR_fprintf(mOutput, "</leaf>\n");
-    }
-    else {
-      PR_fprintf(mOutput, "/>\n");
-    }
-  }
-  else {
-    PRInt32 pos;
-    nsAutoString tmp;
-    char* str = nsnull;
-    switch (nodeType) {
-    case eHTMLTag_whitespace:
-    case eHTMLTag_text:
-      GetNewCString(aNode.GetText(), &str);
-      if(str) {
-        PR_fprintf(mOutput, "<text value=\"%s\"/>\n", str);
-        nsMemory::Free(str);
-      }
-      break;
-
-    case eHTMLTag_newline:
-      PR_fprintf(mOutput, "<newline/>\n");
-      break;
-
-    case eHTMLTag_entity:
-      tmp.Append(aNode.GetText());
-      tmp.Cut(0, 1);
-      pos = tmp.Length() - 1;
-      if (pos >= 0) {
-        tmp.Cut(pos, 1);
-      }
-      PR_fprintf(mOutput, "<entity value=\"%s\"/>\n", NS_LossyConvertUTF16toASCII(tmp).get());
-      break;
-
-    default:
-      NS_NOTREACHED("unsupported leaf node type");
-    }//switch
-  }
-  return NS_OK;
-}
-
-nsresult 
-nsLoggingSink::QuoteText(const nsAString& aValue, nsString& aResult) {
-  aResult.Truncate();
-    /*
-      if you're stepping through the string anyway, why not use iterators instead of forcing the string to copy?
-     */
-  const nsPromiseFlatString& flat = PromiseFlatString(aValue);
-  const PRUnichar* cp = flat.get();
-  const PRUnichar* end = cp + aValue.Length();
-  while (cp < end) {
-    PRUnichar ch = *cp++;
-    if (ch == '"') {
-      aResult.AppendLiteral("&quot;");
-    }
-    else if (ch == '&') {
-      aResult.AppendLiteral("&amp;");
-    }
-    else if ((ch < 32) || (ch >= 127)) {
-      aResult.AppendLiteral("&#");
-      aResult.AppendInt(PRInt32(ch), 10);
-      aResult.Append(PRUnichar(';'));
-    }
-    else {
-      aResult.Append(ch);
-    }
-  }
-  return NS_OK;
-}
-
-/**
- * Use this method to convert nsString to char*. 
- * REMEMBER: Match this call with nsMemory::Free(aResult);
- * 
- * @update 04/04/99 harishd
- * @param aValue - The string value
- * @param aResult - String coverted to char*.
- */
-nsresult
-nsLoggingSink::GetNewCString(const nsAString& aValue, char** aResult)
-{
-  nsresult result=NS_OK;
-  nsAutoString temp;
-  result=QuoteText(aValue,temp);
-  if(NS_SUCCEEDED(result)) {
-    *aResult = temp.IsEmpty() ? nsnull : ToNewCString(temp);
-  }
-  return result;
-}
-
-/**
- * This gets called when handling illegal contents, especially
- * in dealing with tables. This method creates a new context.
- * 
- * @update 04/04/99 harishd
- * @param aPosition - The position from where the new context begins.
- */
-NS_IMETHODIMP
-nsLoggingSink::BeginContext(PRInt32 aPosition) 
-{
-  return NS_OK;
-}
-
-/**
- * This method terminates any new context that got created by
- * BeginContext and switches back to the main context.  
- *
- * @update 04/04/99 harishd
- * @param aPosition - Validates the end of a context.
- */
-NS_IMETHODIMP
-nsLoggingSink::EndContext(PRInt32 aPosition)
-{
-  return NS_OK;
-}
deleted file mode 100644
--- a/parser/htmlparser/src/nsLoggingSink.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef NS_LOGGING_SINK_H__
-#define NS_LOGGING_SINK_H__
-
-#include "nsILoggingSink.h"
-#include "nsIParser.h"
-
-class nsLoggingSink : public nsILoggingSink {
-public:
-  nsLoggingSink();
-  virtual ~nsLoggingSink();
-
-  void SetProxySink(nsIHTMLContentSink *aSink) {
-    mSink=aSink;    
-  }
-
-  void ReleaseProxySink() {
-    NS_IF_RELEASE(mSink);
-    mSink=0;
-  }
-
-
-  // nsISupports
-  NS_DECL_ISUPPORTS
-
-  // nsIContentSink
-  NS_IMETHOD WillParse();
-  NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode);
-  NS_IMETHOD DidBuildModel(bool aTerminated);
-  NS_IMETHOD WillInterrupt();
-  NS_IMETHOD WillResume();
-  NS_IMETHOD SetParser(nsParserBase* aParser);
-  NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
-  NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
-  NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
-  NS_IMETHOD AddComment(const nsIParserNode& aNode);
-  NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
-  NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
-  virtual void FlushPendingNotifications(mozFlushType aType) { }
-  NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
-  virtual nsISupports *GetTarget() { return nsnull; }
-
-  // nsIHTMLContentSink
-  NS_IMETHOD OpenHead();
-  NS_IMETHOD IsEnabled(PRInt32 aTag, bool* aReturn) 
-  /* Take the largest possible feature set. */
-  { NS_ENSURE_ARG_POINTER(aReturn); *aReturn = true; return NS_OK; }
-  NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
-  NS_IMETHOD_(bool) IsFormOnStack() { return false; }
-
-  NS_IMETHOD BeginContext(PRInt32 aPosition);
-  NS_IMETHOD EndContext(PRInt32 aPosition);
-  NS_IMETHOD DidProcessTokens(void) { return NS_OK; }
-  NS_IMETHOD WillProcessAToken(void) { return NS_OK; }
-  NS_IMETHOD DidProcessAToken(void) { return NS_OK; }
-
-  // nsILoggingSink
-  NS_IMETHOD SetOutputStream(PRFileDesc *aStream,bool autoDelete=false);
-
-  nsresult OpenNode(const char* aKind, const nsIParserNode& aNode);
-  nsresult CloseNode(const char* aKind);
-  nsresult LeafNode(const nsIParserNode& aNode);
-  nsresult WriteAttributes(const nsIParserNode& aNode);
-  nsresult QuoteText(const nsAString& aValue, nsString& aResult);
-  nsresult GetNewCString(const nsAString& aValue, char** aResult);
-  bool WillWriteAttributes(const nsIParserNode& aNode);
-
-protected:
-  PRFileDesc          *mOutput;
-  int                  mLevel;
-  nsIHTMLContentSink  *mSink;
-  bool                 mAutoDeleteOutput;
-};
-
-#endif
-
--- a/parser/htmlparser/src/nsParserModule.cpp
+++ b/parser/htmlparser/src/nsParserModule.cpp
@@ -49,24 +49,22 @@
 //#include "nsTextTokenizer.h"
 #include "nsElementTable.h"
 #include "nsParserService.h"
 #include "nsSAXAttributes.h"
 #include "nsSAXLocator.h"
 #include "nsSAXXMLReader.h"
 
 #if defined(NS_DEBUG)
-#include "nsLoggingSink.h"
 #include "nsExpatDriver.h"
 #endif
 
 //----------------------------------------------------------------------
 
 #if defined(NS_DEBUG)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsLoggingSink)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver)
 #endif
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
 NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSAXAttributes)