Bug 1171970. Handle super-long lines in CSS files a bit more gracefully if they cause OOM when creating CSS error messages. r=heycam

This commit is contained in:
Boris Zbarsky 2015-06-05 23:19:11 -04:00
parent 0926e0e518
commit 4056495adb

View File

@ -243,7 +243,11 @@ ErrorReporter::AddToError(const nsString &aErrorText)
// for all errors on that line. That causes the text of the line to
// be shared among all the nsIScriptError objects.
if (mErrorLine.IsEmpty() || mErrorLineNumber != mPrevErrorLineNumber) {
mErrorLine = mScanner->GetCurrentLine();
// Be careful here: the error line might be really long and OOM
// when we try to make a copy here. If so, just leave it empty.
if (!mErrorLine.Assign(mScanner->GetCurrentLine(), fallible)) {
mErrorLine.Truncate();
}
mPrevErrorLineNumber = mErrorLineNumber;
}
} else {