diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp
index 893b3e2264b..68d332b76e8 100644
--- a/mozilla/content/html/document/src/nsHTMLDocument.cpp
+++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp
@@ -2296,19 +2296,13 @@ nsHTMLDocument::WriteCommon(const nsAReadableString& aText,
}
}
- const nsAReadableString *text_to_write = &aText;
- nsAutoString string_buffer;
-
- if (aNewlineTerminate) {
- string_buffer.Assign(aText);
- string_buffer.Append((PRUnichar)'\n');
-
- text_to_write = &string_buffer;
- }
-
mWriteLevel++;
- rv = mParser->Parse(*text_to_write, NS_GENERATE_PARSER_KEY(),
- NS_ConvertASCIItoUCS2("text/html"), PR_FALSE,
+
+ static const NS_NAMED_LITERAL_STRING(sNewLine, "\n");
+
+ rv = mParser->Parse(aNewlineTerminate ? (aText + sNewLine) : aText,
+ NS_GENERATE_PARSER_KEY(),
+ NS_LITERAL_STRING("text/html"), PR_FALSE,
(!mIsWriting || (mWriteLevel > 1)));
mWriteLevel--;
diff --git a/mozilla/htmlparser/public/nsIParser.h b/mozilla/htmlparser/public/nsIParser.h
index 3e6ad765571..b7d83795f6b 100644
--- a/mozilla/htmlparser/public/nsIParser.h
+++ b/mozilla/htmlparser/public/nsIParser.h
@@ -247,7 +247,7 @@ class nsIParser : public nsISupports {
virtual nsresult Parse(nsIURI* aURL,nsIRequestObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0;
virtual nsresult Parse(nsIInputStream& aStream, const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0;
- virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0;
+ virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsAReadableString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0;
virtual nsresult Terminate(void) = 0;
diff --git a/mozilla/htmlparser/src/CParserContext.cpp b/mozilla/htmlparser/src/CParserContext.cpp
index a73eef35625..040cb06db77 100644
--- a/mozilla/htmlparser/src/CParserContext.cpp
+++ b/mozilla/htmlparser/src/CParserContext.cpp
@@ -143,7 +143,7 @@ CParserContext::~CParserContext(){
* Set's the mimetype for this context
* @update rickg 03.18.2000
*/
-void CParserContext::SetMimeType(const nsString& aMimeType){
+void CParserContext::SetMimeType(nsAReadableString& aMimeType){
mMimeType.Assign(aMimeType);
mDocType=ePlainText;
diff --git a/mozilla/htmlparser/src/CParserContext.h b/mozilla/htmlparser/src/CParserContext.h
index e128e8a13fb..c0f2e51a320 100644
--- a/mozilla/htmlparser/src/CParserContext.h
+++ b/mozilla/htmlparser/src/CParserContext.h
@@ -76,7 +76,7 @@ public:
CParserContext( const CParserContext& aContext);
~CParserContext();
- void SetMimeType(const nsString& aMimeType);
+ void SetMimeType(nsAReadableString& aMimeType);
CParserContext* mPrevContext;
nsDTDMode mDTDMode;
diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp
index 99d4a1a5c65..54b3c53eb72 100644
--- a/mozilla/htmlparser/src/nsParser.cpp
+++ b/mozilla/htmlparser/src/nsParser.cpp
@@ -1676,9 +1676,11 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBoo
* @param aMimeType tells us what type of content to expect in the given string
* @return error code -- 0 if ok, non-zero if error.
*/
-nsresult nsParser::Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString&
-aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){
-
+nsresult nsParser::Parse(const nsAReadableString& aSourceBuffer, void* aKey,
+ const nsAReadableString& aMimeType,
+ PRBool aVerifyEnabled, PRBool aLastCall,
+ nsDTDMode aMode){
+
//NOTE: Make sure that updates to this method don't cause
// bug #2361 to break again!
diff --git a/mozilla/htmlparser/src/nsParser.h b/mozilla/htmlparser/src/nsParser.h
index c0612e652b9..e0b32c077fd 100644
--- a/mozilla/htmlparser/src/nsParser.h
+++ b/mozilla/htmlparser/src/nsParser.h
@@ -213,7 +213,7 @@ class nsParser : public nsIParser,
* @param appendTokens tells us whether we should insert tokens inline, or append them.
* @return TRUE if all went well -- FALSE otherwise
*/
- virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect);
+ virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsAReadableString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect);
virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
diff --git a/mozilla/parser/htmlparser/public/nsIParser.h b/mozilla/parser/htmlparser/public/nsIParser.h
index 3e6ad765571..b7d83795f6b 100644
--- a/mozilla/parser/htmlparser/public/nsIParser.h
+++ b/mozilla/parser/htmlparser/public/nsIParser.h
@@ -247,7 +247,7 @@ class nsIParser : public nsISupports {
virtual nsresult Parse(nsIURI* aURL,nsIRequestObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0;
virtual nsresult Parse(nsIInputStream& aStream, const nsString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0;
- virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0;
+ virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsAReadableString& aContentType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0;
virtual nsresult Terminate(void) = 0;
diff --git a/mozilla/parser/htmlparser/src/CParserContext.cpp b/mozilla/parser/htmlparser/src/CParserContext.cpp
index a73eef35625..040cb06db77 100644
--- a/mozilla/parser/htmlparser/src/CParserContext.cpp
+++ b/mozilla/parser/htmlparser/src/CParserContext.cpp
@@ -143,7 +143,7 @@ CParserContext::~CParserContext(){
* Set's the mimetype for this context
* @update rickg 03.18.2000
*/
-void CParserContext::SetMimeType(const nsString& aMimeType){
+void CParserContext::SetMimeType(nsAReadableString& aMimeType){
mMimeType.Assign(aMimeType);
mDocType=ePlainText;
diff --git a/mozilla/parser/htmlparser/src/CParserContext.h b/mozilla/parser/htmlparser/src/CParserContext.h
index e128e8a13fb..c0f2e51a320 100644
--- a/mozilla/parser/htmlparser/src/CParserContext.h
+++ b/mozilla/parser/htmlparser/src/CParserContext.h
@@ -76,7 +76,7 @@ public:
CParserContext( const CParserContext& aContext);
~CParserContext();
- void SetMimeType(const nsString& aMimeType);
+ void SetMimeType(nsAReadableString& aMimeType);
CParserContext* mPrevContext;
nsDTDMode mDTDMode;
diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp
index 99d4a1a5c65..54b3c53eb72 100644
--- a/mozilla/parser/htmlparser/src/nsParser.cpp
+++ b/mozilla/parser/htmlparser/src/nsParser.cpp
@@ -1676,9 +1676,11 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsString& aMimeType,PRBoo
* @param aMimeType tells us what type of content to expect in the given string
* @return error code -- 0 if ok, non-zero if error.
*/
-nsresult nsParser::Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString&
-aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){
-
+nsresult nsParser::Parse(const nsAReadableString& aSourceBuffer, void* aKey,
+ const nsAReadableString& aMimeType,
+ PRBool aVerifyEnabled, PRBool aLastCall,
+ nsDTDMode aMode){
+
//NOTE: Make sure that updates to this method don't cause
// bug #2361 to break again!
diff --git a/mozilla/parser/htmlparser/src/nsParser.h b/mozilla/parser/htmlparser/src/nsParser.h
index c0612e652b9..e0b32c077fd 100644
--- a/mozilla/parser/htmlparser/src/nsParser.h
+++ b/mozilla/parser/htmlparser/src/nsParser.h
@@ -213,7 +213,7 @@ class nsParser : public nsIParser,
* @param appendTokens tells us whether we should insert tokens inline, or append them.
* @return TRUE if all went well -- FALSE otherwise
*/
- virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect);
+ virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsAReadableString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect);
virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);