From b2109cfd93b22edf8d1e730e7195894591381562 Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Thu, 8 Sep 2005 16:43:30 +0000 Subject: [PATCH] Fix for bug 307363 (Don't add '---^' to XML errors in the JS console). r=bsmedberg, sr=jst. --- parser/htmlparser/src/nsExpatDriver.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/parser/htmlparser/src/nsExpatDriver.cpp b/parser/htmlparser/src/nsExpatDriver.cpp index c36d91f621c8..99e184df46ed 100644 --- a/parser/htmlparser/src/nsExpatDriver.cpp +++ b/parser/htmlparser/src/nsExpatDriver.cpp @@ -713,11 +713,10 @@ CreateErrorText(const PRUnichar* aDescription, } static nsresult -CreateSourceText(const PRInt32 aColNumber, - const PRUnichar *aSourceLine, - nsString& aSourceString) +AppendErrorPointer(const PRInt32 aColNumber, + const PRUnichar *aSourceLine, + nsString& aSourceString) { - aSourceString.Append(aSourceLine); aSourceString.Append(PRUnichar('\n')); // Last character will be '^'. @@ -810,21 +809,21 @@ nsExpatDriver::HandleError() CreateErrorText(description.get(), XML_GetBase(mExpatParser), lineNumber, colNumber, errorText); - nsAutoString sourceText; - CreateSourceText(colNumber, mLastLine.get(), sourceText); - nsCOMPtr cs (do_GetService(NS_CONSOLESERVICE_CONTRACTID)); nsCOMPtr serr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID)); if (serr && cs) { if (NS_SUCCEEDED(serr->Init(description.get(), mURISpec.get(), - sourceText.get(), + mLastLine.get(), lineNumber, colNumber, nsIScriptError::errorFlag, "malformed-xml"))) cs->LogMessage(serr); } + nsAutoString sourceText(mLastLine); + AppendErrorPointer(colNumber, mLastLine.get(), sourceText); + NS_ASSERTION(mSink, "no sink?"); if (mSink) { mSink->ReportError(errorText.get(), sourceText.get());