Page MenuHomePhabricator

No warning is shown when previewing a "sanitized-css" page containing unsupported CSS
Closed, ResolvedPublicBUG REPORT

Description

Follow-up to T217722.

How to reproduce:

  • Start editing a page that has "sanitized-css" content model (example of page).
  • Add some unsupported CSS (for example :is(.foobar) selector).
  • Do "Show preview" or "Show changes".

Expected: A warning is supposed to be shown, pointing out the unsupported CSS. (The warning from the right picture of T266157#7450639, below the preview note.)

Current: No warning is shown.

(Though, when doing "Publish changes", the publishing is prevented and a warning pointing out the unsupported CSS is shown, as expected.)

What I tried, without success:

  • Setting the interface language to English, to avoid using the custom MediaWiki:Previewnote.
  • Disabling the Live preview feature ("Show preview without reloading the page").

Event Timeline

Tgr subscribed.

This worked in the past (also with live preview, that was T190120).

I can see a preview warning for invalid JSON, so the error seems specific to TemplateStyles.

I don't understand how it could have ever worked in production. The only thing that adds warnings is TemplateStylesContentHandler::fillParserOutput(), but SyntaxHighlight's ContentGetParserOutput hook returns false, so fillParserOutput() is never called. SyntaxHighlight parses the content as wikitext, calling Parser::parse() directly. This all appears to have been the case in 2021 so I don't understand how it could have worked back then.

This appears to have been fixed. SyntaxHighlight was recently changed to use the ContentAlterParserOutput hook instead of ContentGetParserOutput. I'm guessing that's why.

Screenshot 2025-05-24 at 11.50.15 PM.png (844×1 px, 110 KB)

Looks like this is fixed now—turns out the change in SyntaxHighlight’s hook did the trick. Thanks to everyone who helped look into this! Closing the ticket.