r107823 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107822‎ | r107823 | r107824 >
Date:12:19, 2 January 2012
Author:ialex
Status:ok
Tags:
Comment:
* Always set 'userjs' and 'userjsprev' items to false since they are now incorporated in 'bottomscript' (only affects skins not using OutputPage::headElement())
* Removed SkinTemplate::setupUserJs() since it's no longer used and marked OutputPage::isUserJsAllowed() for removal in 1.20 since its last call is now gone
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -1208,9 +1208,11 @@
12091209 * Return whether user JavaScript is allowed for this page
12101210 * @deprecated since 1.18 Load modules with ResourceLoader, and origin and
12111211 * trustworthiness is identified and enforced automagically.
 1212+ * Will be removed in 1.20.
12121213 * @return Boolean
12131214 */
12141215 public function isUserJsAllowed() {
 1216+ wfDeprecated( __METHOD__, '1.18' );
12151217 return $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) >= ResourceLoaderModule::ORIGIN_USER_INDIVIDUAL;
12161218 }
12171219
Index: trunk/phase3/includes/SkinTemplate.php
@@ -194,12 +194,8 @@
195195 $tpl->set( 'pagecss', false );
196196 $tpl->set( 'usercss', false );
197197
198 - $this->userjs = $this->userjsprev = false;
199 - # @todo FIXME: This is the only use of OutputPage::isUserJsAllowed() anywhere; can we
200 - # get rid of it? For that matter, why is any of this here at all?
201 - $this->setupUserJs( $out->isUserJsAllowed() );
202 - $tpl->setRef( 'userjs', $this->userjs );
203 - $tpl->setRef( 'userjsprev', $this->userjsprev );
 198+ $tpl->set( 'userjs', false );
 199+ $tpl->set( 'userjsprev', false );
204200
205201 $tpl->set( 'jsvarurl', false );
206202
@@ -1219,25 +1215,6 @@
12201216 return $this->getTitle()->getNamespaceKey();
12211217 }
12221218
1223 - /**
1224 - * @private
1225 - * @todo FIXME: Why is this duplicated in/from OutputPage::getHeadScripts()??
1226 - */
1227 - function setupUserJs( $allowUserJs ) {
1228 - global $wgJsMimeType;
1229 - wfProfileIn( __METHOD__ );
1230 -
1231 - if( $allowUserJs && $this->loggedin ) {
1232 - if( $this->getTitle()->isJsSubpage() and $this->getOutput()->userCanPreview() ) {
1233 - # XXX: additional security check/prompt?
1234 - $this->userjsprev = '/*<![CDATA[*/ ' . $this->getRequest()->getText( 'wpTextbox1' ) . ' /*]]>*/';
1235 - } else {
1236 - $this->userjs = self::makeUrl( $this->userpage . '/' . $this->skinname . '.js', 'action=raw&ctype=' . $wgJsMimeType );
1237 - }
1238 - }
1239 - wfProfileOut( __METHOD__ );
1240 - }
1241 -
12421219 public function commonPrintStylesheet() {
12431220 return false;
12441221 }

Status & tagging log