Commit graph

2 commits

Author SHA1 Message Date
C. Scott Ananian
008095280a Use canonical parser options when rendering JavaScript/CSS for side effects
In the JavaScript and CSS content handlers we render the page "as
wikitext" solely to generate categories, toc, etc, and then throw that
output away and replace the generated HTML.  Simplify the code paths
and the caching by using the canonical options which don't split by
user language, etc.

Three minor issues with the current patch, which can hopefully be
addressed in follow ups:

1. WikiPage::makeParserOptionsFromTitleAndModel() has a very cumbersome
   name and arguably doesn't belong in WikiPage in the first place.
   T313455 already exists to find a better place for this/way to do this.

2. Title::isConversionTable() requires a downcast of the page reference
   to a full title object.  This method also probably wants to live
   somewhere else.

3. It really would be nice to combine this more properly with
   ContentHandler::getParserOutputForIndexing(), but that method
   uses a ParserOutputAccess object which requires a PageRecord,
   and we don't have a PageRecord available in fillParserOutput().

Bug: T307691
Change-Id: I081105741b507ed49e19cb878550ba4293e09413
2022-07-28 10:45:35 -04:00
C. Scott Ananian
83d9423743 Add *ContentHandlerIntegrationTest
These tests appear to have been present previously, but were inadvertently
omitted from the refactor in fa5237eb48.

This patch just updates the tests to undo code rot and re-enables them.
It contains some placeholders for T307691 tests as well, which will be
enabled in a follow-up patch.

Change-Id: I73d0ed406b3ca8f94b384b76d6e01a5ca1b58e12
2022-07-21 15:30:14 -04:00