Bug 1520812. Remove bogus assertion in nsExpatDriver::HandleError. r=hsivonen

Any time we stop a load of an XML document before we've gotten all the data,
we'll end up in this code with mSink null, because nsParser::Terminate ends up
calling nsExpatDriver::DidBuildModel which nulls out mSink, and not getting all
the data means the XML won't be well-formed.

Differential Revision: https://phabricator.services.mozilla.com/D16856

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-01-17 15:34:15 +00:00
parent 5e4c79d90d
commit eb529dfa42
2 changed files with 2 additions and 4 deletions

View File

@ -732,8 +732,6 @@ nsresult nsExpatDriver::HandleError() {
CreateErrorText(description.get(), XML_GetBase(mExpatParser), lineNumber,
colNumber, errorText);
NS_ASSERTION(mSink, "no sink?");
nsAutoString sourceText(mLastLine);
AppendErrorPointer(colNumber, mLastLine.get(), sourceText);
@ -749,6 +747,7 @@ nsresult nsExpatDriver::HandleError() {
// If it didn't initialize, we can't do any logging.
bool shouldReportError = NS_SUCCEEDED(rv);
// mSink might be null here if our parser was terminated.
if (mSink && shouldReportError) {
rv = mSink->ReportError(errorText.get(), sourceText.get(), serr,
&shouldReportError);
@ -757,6 +756,7 @@ nsresult nsExpatDriver::HandleError() {
}
}
// mOriginalSink might be null here if our parser was terminated.
if (mOriginalSink) {
nsCOMPtr<Document> doc = do_QueryInterface(mOriginalSink->GetTarget());
if (doc && doc->SuppressParserErrorConsoleMessages()) {