Fix for bug 307363 (Don't add '---^' to XML errors in the JS console). r=bsmedberg, sr=jst.

This commit is contained in:
peterv%propagandism.org 2005-09-08 16:43:30 +00:00
Родитель 8960623984
Коммит b2109cfd93
1 изменённых файлов: 7 добавлений и 8 удалений

Просмотреть файл

@ -713,11 +713,10 @@ CreateErrorText(const PRUnichar* aDescription,
}
static nsresult
CreateSourceText(const PRInt32 aColNumber,
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<nsIConsoleService> cs
(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
nsCOMPtr<nsIScriptError> 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());