mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Fixing bug 104031. Bad string code in nsHTMLDocument::WriteCommon(). r=bzbarsky@mit.edu, sr=vidur@netscape.com
This commit is contained in:
parent
e38febc53e
commit
a0b52cf92d
@ -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--;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
CParserContext( const CParserContext& aContext);
|
||||
~CParserContext();
|
||||
|
||||
void SetMimeType(const nsString& aMimeType);
|
||||
void SetMimeType(nsAReadableString& aMimeType);
|
||||
|
||||
CParserContext* mPrevContext;
|
||||
nsDTDMode mDTDMode;
|
||||
|
@ -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!
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
CParserContext( const CParserContext& aContext);
|
||||
~CParserContext();
|
||||
|
||||
void SetMimeType(const nsString& aMimeType);
|
||||
void SetMimeType(nsAReadableString& aMimeType);
|
||||
|
||||
CParserContext* mPrevContext;
|
||||
nsDTDMode mDTDMode;
|
||||
|
@ -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!
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user