But 427779. Make the XML parser not bail out on invalid URI in <xhtml:base>. r+sr=sicking
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 10 Oct 2008 13:44:43 -0400
changeset 20270 94ee77d90fef1ec8bd088d264dc7d4c6504f1aeb
parent 20269 eb627a89b7030840fa5955adfeecb0944f6fd614
child 20271 3762e6244e6398f7dd5dd222badac7512cbb1815
push id2759
push userbzbarsky@mozilla.com
push dateFri, 10 Oct 2008 17:45:08 +0000
treeherdermozilla-central@95e6729d8079 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs427779
milestone1.9.1b2pre
But 427779. Make the XML parser not bail out on invalid URI in <xhtml:base>. r+sr=sicking
content/xml/document/src/nsXMLContentSink.cpp
content/xml/document/src/nsXMLContentSink.h
--- a/content/xml/document/src/nsXMLContentSink.cpp
+++ b/content/xml/document/src/nsXMLContentSink.cpp
@@ -626,17 +626,17 @@ nsXMLContentSink::CloseElement(nsIConten
       mParser->BlockParser();
       rv = NS_ERROR_HTMLPARSER_BLOCK;
     }
 
     return rv;
   }
   
   if (nodeInfo->Equals(nsGkAtoms::base, kNameSpaceID_XHTML) &&
-           !mHasProcessedBase) {
+      !mHasProcessedBase) {
     // The first base wins
     rv = ProcessBASETag(aContent);
     mHasProcessedBase = PR_TRUE;
   }
   else if (nodeInfo->Equals(nsGkAtoms::meta, kNameSpaceID_XHTML) &&
            // Need to check here to make sure this meta tag does not set
            // mPrettyPrintXML to false when we have a special root!
            (!mPrettyPrintXML || !mPrettyPrintHasSpecialRoot)) {
@@ -778,43 +778,39 @@ nsXMLContentSink::ProcessStyleLink(nsICo
                                        aTitle, aType, aMedia);
 
   // nsContentSink::ProcessStyleLink handles the bookkeeping here wrt
   // pending sheets.
   
   return rv;
 }
 
-nsresult
+void
 nsXMLContentSink::ProcessBASETag(nsIContent* aContent)
 {
   NS_ASSERTION(aContent, "missing base-element");
 
-  nsresult rv = NS_OK;
-
   if (mDocument) {
     nsAutoString value;
   
     if (aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::target, value)) {
       mDocument->SetBaseTarget(value);
     }
 
     if (aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, value)) {
       nsCOMPtr<nsIURI> baseURI;
-      rv = NS_NewURI(getter_AddRefs(baseURI), value);
+      nsresult rv = NS_NewURI(getter_AddRefs(baseURI), value);
       if (NS_SUCCEEDED(rv)) {
         rv = mDocument->SetBaseURI(baseURI); // The document checks if it is legal to set this base
         if (NS_SUCCEEDED(rv)) {
           mDocumentBaseURI = mDocument->GetBaseURI();
         }
       }
     }
   }
-
-  return rv;
 }
 
 
 NS_IMETHODIMP 
 nsXMLContentSink::SetDocumentCharset(nsACString& aCharset)
 {
   if (mDocument) {
     mDocument->SetDocumentCharacterSet(aCharset);
--- a/content/xml/document/src/nsXMLContentSink.h
+++ b/content/xml/document/src/nsXMLContentSink.h
@@ -147,17 +147,17 @@ protected:
   nsresult AddContentAsLeaf(nsIContent *aContent);
 
   nsIContent* GetCurrentContent();
   StackNode & GetCurrentStackNode();
   nsresult PushContent(nsIContent *aContent);
   void PopContent();
   PRBool HaveNotifiedForCurrentContent() const;
 
-  nsresult ProcessBASETag(nsIContent* aContent);
+  void ProcessBASETag(nsIContent* aContent);
 
   nsresult FlushTags();
 
   void UpdateChildCounts();
 
   void DidAddContent()
   {
     if (IsTimeToNotify()) {