Page MenuHomePhabricator

ResourceLoaderWikiModule should not convert " " to a space for pages from the MediaWiki-namespace
Closed, ResolvedPublic

Description

If a Javascript file loaded through ResourceLoader contains the text strings " ", " ", or " ", these will be changed to a raw space or non-breaking space. This causes a problem in [[en:MediaWiki:Gadget-charinsert.js]], as that gadget wants to effectively do document.createTextNode(' ') to include the literal string " " in the charinsert box.

The source of the replacement is in includes/cache/MessageCache.php, at the end of get(). Since that's in such a low-level function, I don't know what the consequences of changing it might be for other messages. Another possibility might be to have ResourceLoader use getMsgFromNamespace instead to avoid the problematic replacement.


Version: 1.17.x
Severity: major

Details

Reference
bz40660

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:52 AM
bzimport set Reference to bz40660.
Anomie created this task.Oct 1 2012, 2:32 PM

RL shouldn't be loading JS/CSS via wfMessage. Work around is to split the string into two parts.

(In reply to comment #1)

RL shouldn't be loading JS/CSS via wfMessage. Work around is to split the
string into two parts.

ResourceLoaderWikiModule uses Revision::getRawText, except if it comes from NS_MEDIAWIKI in which case it tries MessageCache first (for efficiency I guess).

I think the reason we do it this way is because technically MediaWiki: pages are messages, and they can have default values in the .i18n.php files that we want to respect. But I don't think that's really ever used by anyone, I'll try removing this logic.

Ica7f35fefcc200f0b3daf1d06d98a0b8ea878f3a.

Restricted Application added a project: Performance-Team. · View Herald TranscriptOct 16 2020, 5:43 PM