Insert an error message block when parsing was stopped after an error

The <parsererror> element was not being added to the parsed document in
certain cases involving attribute parsing. For example, if an undeclared
namespace prefix was used in the document, then parsing would stop, but
a <parsererror> element would not be inserted into the document to
indicate that a parsing error occurred.

When XMLDocumentParser::StopParsing() is called to stop parsing, call
InsertErrorMessageBlock() to insert the <parsererror> element if an
error occurred.

Based on https://codereview.chromium.org/771493002/ by dtrebbien@gmail.com

Bug: 295809, 898775
Change-Id: Ic67a3ab885fae4b01ca92f6d927b3f523f7423ed
Reviewed-on: https://chromium-review.googlesource.com/c/1224791
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602674}
2 files changed