зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 307363 (Don't add '---^' to XML errors in the JS console). r=bsmedberg, sr=jst.
This commit is contained in:
Родитель
8960623984
Коммит
b2109cfd93
|
@ -713,11 +713,10 @@ CreateErrorText(const PRUnichar* aDescription,
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
CreateSourceText(const PRInt32 aColNumber,
|
AppendErrorPointer(const PRInt32 aColNumber,
|
||||||
const PRUnichar *aSourceLine,
|
const PRUnichar *aSourceLine,
|
||||||
nsString& aSourceString)
|
nsString& aSourceString)
|
||||||
{
|
{
|
||||||
aSourceString.Append(aSourceLine);
|
|
||||||
aSourceString.Append(PRUnichar('\n'));
|
aSourceString.Append(PRUnichar('\n'));
|
||||||
|
|
||||||
// Last character will be '^'.
|
// Last character will be '^'.
|
||||||
|
@ -810,21 +809,21 @@ nsExpatDriver::HandleError()
|
||||||
CreateErrorText(description.get(), XML_GetBase(mExpatParser), lineNumber,
|
CreateErrorText(description.get(), XML_GetBase(mExpatParser), lineNumber,
|
||||||
colNumber, errorText);
|
colNumber, errorText);
|
||||||
|
|
||||||
nsAutoString sourceText;
|
|
||||||
CreateSourceText(colNumber, mLastLine.get(), sourceText);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIConsoleService> cs
|
nsCOMPtr<nsIConsoleService> cs
|
||||||
(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||||
nsCOMPtr<nsIScriptError> serr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
nsCOMPtr<nsIScriptError> serr(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||||
if (serr && cs) {
|
if (serr && cs) {
|
||||||
if (NS_SUCCEEDED(serr->Init(description.get(),
|
if (NS_SUCCEEDED(serr->Init(description.get(),
|
||||||
mURISpec.get(),
|
mURISpec.get(),
|
||||||
sourceText.get(),
|
mLastLine.get(),
|
||||||
lineNumber, colNumber,
|
lineNumber, colNumber,
|
||||||
nsIScriptError::errorFlag, "malformed-xml")))
|
nsIScriptError::errorFlag, "malformed-xml")))
|
||||||
cs->LogMessage(serr);
|
cs->LogMessage(serr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsAutoString sourceText(mLastLine);
|
||||||
|
AppendErrorPointer(colNumber, mLastLine.get(), sourceText);
|
||||||
|
|
||||||
NS_ASSERTION(mSink, "no sink?");
|
NS_ASSERTION(mSink, "no sink?");
|
||||||
if (mSink) {
|
if (mSink) {
|
||||||
mSink->ReportError(errorText.get(), sourceText.get());
|
mSink->ReportError(errorText.get(), sourceText.get());
|
||||||
|
|
Загрузка…
Ссылка в новой задаче