ParserOutput::collectMetadata: Suppress hard failures from Parsoid
commit71f27054987c8ac906ebe8ef5e7be9999d22454f
authorC. Scott Ananian <cscott@cscott.net>
Fri, 11 Mar 2022 17:47:36 +0000 (11 12:47 -0500)
committerC. Scott Ananian <cscott@cscott.net>
Fri, 11 Mar 2022 17:51:32 +0000 (11 12:51 -0500)
tree4df1c5d739da1518d905c1ce025cf7db89d956ed
parenta3000c2972095eee092b8cc91ed055d56956f5b7
ParserOutput::collectMetadata: Suppress hard failures from Parsoid

A number of exceptions assume that the ParserAfterParse hook is called
exactly once per top-level page, and use that hook to "finalize"
various write-once properties in ParserOutput, including jsconfigvars.
Unfortunately, ParserAfterParse can't be supported properly in Parsoid
(T303630), which results in legacy extensions using this hook
overwriting extensiondata and jsconfigvars multiple times.

Instead of throwing an exception, restore the previous Parsoid
behavior where the last write wins.  This doesn't fix the root cause,
but at least it doesn't regress.  Eventually we'll have to deprecate
the ParserAfterParse hook, and when we do so we can add deprecation
warnings to these code paths in ParserOutput::collectMetadata() as
well and eventually remove them.

Noting uses ParserOutput::collectMetadata() except Parsoid at the
moment.

Bug: T303014
Bug: T303015
Change-Id: I9d1f0f6bab1305552a0350667d6142a24bc04049
includes/parser/ParserOutput.php