Send users whose browsers support JS but are unsupported by MW to the WTE using venoscript=1

Bug: T123457
Change-Id: Ia7e6f4dc1b7dc15fa287bf6b2c4ea12eb4a7c4ba
Depends-On: Ice6ebb95bfcb2050f4813705467942f95f7e720c
This commit is contained in:
Alex Monk 2016-01-23 00:14:32 +00:00 committed by Krinkle
parent 2837cfb400
commit 188ec0f5d2

View file

@ -153,19 +153,26 @@ class VisualEditorHooks {
isset( $params['preloadparams'] );
// Known-good parameters: edit, veaction, section, vesection, veswitched
$params['venoscript'] = '1';
$url = wfScript() . '?' . wfArrayToCgi( $params );
$out = $article->getContext()->getOutput();
if ( !$ret ) {
$out = $article->getContext()->getOutput();
$params['venoscript'] = '1';
$url = htmlspecialchars( wfScript() . '?' . wfArrayToCgi( $params ) );
$escapedUrl = htmlspecialchars( $url );
$out->addHeadItem(
've-noscript-fallback',
"<noscript><meta http-equiv=\"refresh\" content=\"0; url=$url\"></noscript>"
"<noscript><meta http-equiv=\"refresh\" content=\"0; url=$escapedUrl\"></noscript>"
);
$titleMsg = $title->exists() ? 'editing' : 'creating';
$out->setPageTitle( wfMessage( $titleMsg, $title->getPrefixedText() ) );
}
$out->addScript( Html::inlineScript(
"(window.NORLQ=window.NORLQ||[]).push(" .
"function(){" .
"location.href=\"$url\";" .
"}" .
");"
) );
return $ret;
}