Upstream changed the JSON parser to be strictly compliant with RFC8259
and that breaks cases where we were feeding the JSON parser strings
that contained C++ // style comments (e.g. some tests) as well as
data that we don't control (e.g. Ethereum related) that arrived with
control chars in the middle, for instance.
Since we pass options such as JSONParserOptions::JSON_ALLOW_COMMENTS
or JSONParserOptions::JSON_ALLOW_TRAILING_COMMAS to Read*() methods,
the new default JSON_PARSE_CHROMIUM_EXTENSIONS (which groups all the
different extensions that were not configurable until now) is not being
used and we now fail to parse several cases where we shouldn't.
To fix this, we follow upstream's lead and make sure that every call
to a JSONReader::Read*() that is specifying the |options| parameter
also includes base::JSON_PARSE_CHROMIUM_EXTENSIONS, so that we get to
keep the previous functionality.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/115268f27364b52ec68526a758e432792dab43be
commit 115268f27364b52ec68526a758e432792dab43be
Author: Robert Sesek <rsesek@chromium.org>
Date: Tue Dec 14 16:30:29 2021 +0000
base: Make JSON_PARSE_RFC optionally strictly compliant with RFC 8259.
The existing non-configurable Chromium extensions are now individually
configurable, with a flag JSON_PARSE_CHROMIUM that enables them all.
This also adds metrics to record the non-standard extension usage, to
see if any of these can be dropped. In order to avoid breaking the
numerous callers of the JSONReader, the parse options default to the
Chromium-style.
Bug: 1269888