[XML] Pass better parsing errors to through data_decoder

The xmllib parsing library gives quite nice errors when parsing an
XML document fails. Unfortunately, when using XMLParser (which is
leveraged by the data_decoder service, and used whenever the browser
process needs to parse XML), these errors are simply emitted to stderr
and a generic error is passed back.

Instead, gather these errors when attempting to parse the XML document
and return them with the error from XMLParser.

Example: Given (bad) input
"<fragment><dim>hello <url>foo</dim> world</url></fragment>"

Before:
Invalid XML: bad content

After:
Invalid XML: bad content: Entity: line 1: parser error : Opening and
ending tag mismatch: url line 1 and dim
<dim>hello <url>foo</dim> world</url></fragment>

Add unit tests for the new errors, and update the use in the
extension omnibox API to take advantage of them.

Bug: 1186804
Change-Id: I4ca75285a3fe4e5fbfb9ea04385efa0206776b60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3470269
Reviewed-by: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
Reviewed-by: Tim <tjudkins@chromium.org>
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Devlin Cronin <rdevlin.cronin@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/main@{#973881}
NOKEYCHECK=True
GitOrigin-RevId: a98d3feec31434887d768c28d848797b282fed2c
1 file changed