Bug 720124 - Remove dead code from HTMLContentSink: AddDocTypeDecl; r=hsivonen
authorMs2ger <ms2ger@gmail.com>
Wed, 25 Jan 2012 08:50:02 +0100
changeset 86423 90ce75a0083fe9594a04b055cb35caee10ed843b
parent 86422 086f5438276f90f2a9bbfbfa891b92f1b33d09a3
child 86424 2bb09ec057e6e16f3831117e474596ab964e2dea
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)
reviewershsivonen
bugs720124
milestone12.0a1
Bug 720124 - Remove dead code from HTMLContentSink: AddDocTypeDecl; r=hsivonen
content/base/src/mozSanitizingSerializer.cpp
content/base/src/mozSanitizingSerializer.h
content/base/src/nsPlainTextSerializer.h
content/html/document/src/nsHTMLContentSink.cpp
parser/htmlparser/public/nsIHTMLContentSink.h
parser/htmlparser/src/CNavDTD.cpp
parser/htmlparser/src/nsLoggingSink.cpp
parser/htmlparser/src/nsLoggingSink.h
toolkit/components/places/nsPlacesImportExportService.cpp
--- a/content/base/src/mozSanitizingSerializer.cpp
+++ b/content/base/src/mozSanitizingSerializer.cpp
@@ -312,22 +312,16 @@ mozSanitizingHTMLSerializer::AddLeaf(con
   eHTMLTags type = (eHTMLTags)aNode.GetNodeType();
   const nsAString& text = aNode.GetText();
 
   mParserNode = const_cast<nsIParserNode*>(&aNode);
   return DoAddLeaf(type, text);
 }
 
 NS_IMETHODIMP 
-mozSanitizingHTMLSerializer::AddDocTypeDecl(const nsIParserNode& aNode)
-{
-  return NS_OK;
-}
-
-NS_IMETHODIMP 
 mozSanitizingHTMLSerializer::SetDocumentCharset(nsACString& aCharset)
 {
   // No idea, if this works - it isn't invoked by |TestOutput|.
   Write(NS_LITERAL_STRING("\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=")
         /* Danger: breaking the line within the string literal, like
            "foo"\n"bar", breaks win32! */
         + nsAdoptingString(escape(NS_ConvertASCIItoUTF16(aCharset)))
         + NS_LITERAL_STRING("\">\n"));
--- a/content/base/src/mozSanitizingSerializer.h
+++ b/content/base/src/mozSanitizingSerializer.h
@@ -105,17 +105,16 @@ public:
   NS_IMETHOD WillResume(void) { return NS_OK; }
   NS_IMETHOD SetParser(nsParserBase* aParser) { return NS_OK; }
   NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
   NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
   NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
   NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
   NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode)
                                                     { return NS_OK; }
-  NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
   virtual void FlushPendingNotifications(mozFlushType aType) { }
   NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
   virtual nsISupports *GetTarget() { return nsnull; }
 
   // nsIHTMLContentSink
   NS_IMETHOD OpenHead();
   NS_IMETHOD IsEnabled(PRInt32 aTag, bool* aReturn);
   NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
--- a/content/base/src/nsPlainTextSerializer.h
+++ b/content/base/src/nsPlainTextSerializer.h
@@ -105,17 +105,16 @@ public:
   NS_IMETHOD WillInterrupt(void) { return NS_OK; }
   NS_IMETHOD WillResume(void) { return NS_OK; }
   NS_IMETHOD SetParser(nsParserBase* aParser) { return NS_OK; }
   NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
   NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
   NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
   NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
   NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) { return NS_OK; }
-  NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode) { return NS_OK; }
   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);
   NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
--- a/content/html/document/src/nsHTMLContentSink.cpp
+++ b/content/html/document/src/nsHTMLContentSink.cpp
@@ -199,17 +199,16 @@ public:
 
   // nsIHTMLContentSink
   NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
   NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
   NS_IMETHOD CloseMalformedContainer(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);
   NS_IMETHOD DidProcessTokens(void);
   NS_IMETHOD WillProcessAToken(void);
   NS_IMETHOD DidProcessAToken(void);
   NS_IMETHOD BeginContext(PRInt32 aID);
   NS_IMETHOD EndContext(PRInt32 aID);
   NS_IMETHOD OpenHead();
   NS_IMETHOD IsEnabled(PRInt32 aTag, bool* aReturn);
   NS_IMETHOD_(bool) IsFormOnStack();
@@ -2104,28 +2103,16 @@ nsresult
 HTMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode)
 {
   nsresult result = NS_OK;
   // Implementation of AddProcessingInstruction() should start here
 
   return result;
 }
 
-/**
- *  This gets called by the parser when it encounters
- *  a DOCTYPE declaration in the HTML document.
- */
-
-NS_IMETHODIMP
-HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode)
-{
-  MOZ_NOT_REACHED("Must not use HTMLContentSink for doctypes.");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
 NS_IMETHODIMP
 HTMLContentSink::DidProcessTokens(void)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HTMLContentSink::WillProcessAToken(void)
--- a/parser/htmlparser/public/nsIHTMLContentSink.h
+++ b/parser/htmlparser/public/nsIHTMLContentSink.h
@@ -78,18 +78,18 @@
  * NOTE: I haven't figured out how sub-documents (non-frames)
  *       are going to be handled. Stay tuned.
  */
 #include "nsIParserNode.h"
 #include "nsIContentSink.h"
 #include "nsHTMLTags.h"
 
 #define NS_IHTML_CONTENT_SINK_IID \
-{ 0x44b5a4f4, 0x01f7, 0x4116, \
-  { 0xb5, 0xa5, 0x56, 0x4d, 0x64, 0x0b, 0x68, 0x1f } }
+{ 0xa3aad227, 0xe137, 0x407c, \
+  { 0xa4, 0xa0, 0x9e, 0x23, 0xb6, 0x38, 0xf3, 0x42 } }
 
 #define MAX_REFLOW_DEPTH  200
 
 class nsIHTMLContentSink : public nsIContentSink 
 {
 public:
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTML_CONTENT_SINK_IID)
@@ -201,26 +201,16 @@ public:
    * model.
    *
    * @update 4/1/98 gess
    * @param  nsIParserNode reference to parser node interface
    */     
   NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) = 0;
 
   /**
-   * This method is called by the parser when it encounters
-   * a document type declaration.
-   *
-   * XXX Should the parser also parse the internal subset?
-   *
-   * @param  nsIParserNode reference to parser node interface
-   */
-  NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode) = 0;
-
-  /**
    * Call this method to determnine if a FORM is on the sink's stack
    *
    * @return true if found else false
    */
   NS_IMETHOD_(bool) IsFormOnStack() = 0;
 
 };
 
--- a/parser/htmlparser/src/CNavDTD.cpp
+++ b/parser/htmlparser/src/CNavDTD.cpp
@@ -1982,25 +1982,17 @@ CNavDTD::HandleDocTypeDeclToken(CToken* 
   if (pos != kNotFound) {
     // First remove '>' from the end.
     docTypeStr.Cut(pos, len - pos);
   }
 
   // Now remove "<!" from the begining
   docTypeStr.Cut(0, 2);
   theToken->SetStringValue(docTypeStr);
-
-  nsCParserNode* theNode = mNodeAllocator.CreateNode(aToken, mTokenAllocator);
-  NS_ENSURE_TRUE(theNode, NS_ERROR_OUT_OF_MEMORY);
-
-  nsresult result = mSink ? mSink->AddDocTypeDecl(*theNode) : NS_OK;
-
-  IF_FREE(theNode, &mNodeAllocator);
-
-  return result;
+  return NS_OK;
 }
 
 /**
  * Retrieve the attributes for this node, and add then into
  * the node.
  *
  * @update  gess4/22/98
  * @param   aNode is the node you want to collect attributes for
--- a/parser/htmlparser/src/nsLoggingSink.cpp
+++ b/parser/htmlparser/src/nsLoggingSink.cpp
@@ -237,39 +237,16 @@ nsLoggingSink::AddProcessingInstruction(
   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  
  */
--- a/parser/htmlparser/src/nsLoggingSink.h
+++ b/parser/htmlparser/src/nsLoggingSink.h
@@ -66,17 +66,16 @@ public:
   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. */
--- a/toolkit/components/places/nsPlacesImportExportService.cpp
+++ b/toolkit/components/places/nsPlacesImportExportService.cpp
@@ -369,17 +369,16 @@ public:
   NS_IMETHOD DidProcessTokens() { return NS_OK; }
   NS_IMETHOD WillProcessAToken() { return NS_OK; }
   NS_IMETHOD DidProcessAToken() { return NS_OK; }
   NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
   NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
   NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
   NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
   NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) { return NS_OK; }
-  NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode) { return NS_OK; }
   NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
   NS_IMETHOD_(bool) IsFormOnStack() { return false; }
 
 protected:
   nsCOMPtr<nsINavBookmarksService> mBookmarksService;
   nsCOMPtr<nsINavHistoryService> mHistoryService;
   nsCOMPtr<nsIAnnotationService> mAnnotationService;
   nsCOMPtr<nsILivemarkService> mLivemarkService;