Page MenuHomePhabricator

Add ParserOutput::addOutputData() to unify various accumulators in ParserOutput
Open, Needs TriagePublic


(See T292868: Migrate boolean flags in ParserOutput to ::setFlag() or ::setOutputFlag() or ::setExtensionData() for a similar task involving boolean flags.)

ParserOutput contains a number of "accumulator" methods, which add new values to a list. The creation of the Content-Security-Policy source lists (::addExtraCSP*Src()) are good examples, but we also have some TTL maintenance operations like updateRuntimeAdaptiveExpiry() which funamentally maintain a list of possible "maximum time to live" values, and then selects the lowest of these in when ::finalizeAdaptiveCacheExpiry() is finally called.

In this task, create a new ::addOutputData() method to generalize the accumulators for Parsoid's ContentMetadataCollector interfaces so that this functionality is exposed to extensions but the full complexity is not exposed to Parsoid itself. T292868 is similar, but that task deals with boolean-valued flags. In order to maintain type safety, we'll keep the string/int accumulator methods separate from the boolean flag methods.

See also T296123: Simplify string|array argument type for ParserOutput::addModules()/::addModuleStyles()/::addJsConfigVars() which deal with another collection of accumulator methods.

Event Timeline

Change 740943 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] Add ParserOutput::addOutputData() to unify various ParserOutput accumulators