From 22f0f724bb806d8a218565063d61c9cb276db386 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Mon, 2 Jan 2012 12:19:24 +0000 Subject: [PATCH] * 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 --- includes/OutputPage.php | 2 ++ includes/SkinTemplate.php | 27 ++------------------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 84fe1e9ef7..f975a1f327 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1208,9 +1208,11 @@ class OutputPage extends ContextSource { * Return whether user JavaScript is allowed for this page * @deprecated since 1.18 Load modules with ResourceLoader, and origin and * trustworthiness is identified and enforced automagically. + * Will be removed in 1.20. * @return Boolean */ public function isUserJsAllowed() { + wfDeprecated( __METHOD__, '1.18' ); return $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) >= ResourceLoaderModule::ORIGIN_USER_INDIVIDUAL; } diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index d23ced487f..096393b14d 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -194,12 +194,8 @@ class SkinTemplate extends Skin { $tpl->set( 'pagecss', false ); $tpl->set( 'usercss', false ); - $this->userjs = $this->userjsprev = false; - # @todo FIXME: This is the only use of OutputPage::isUserJsAllowed() anywhere; can we - # get rid of it? For that matter, why is any of this here at all? - $this->setupUserJs( $out->isUserJsAllowed() ); - $tpl->setRef( 'userjs', $this->userjs ); - $tpl->setRef( 'userjsprev', $this->userjsprev ); + $tpl->set( 'userjs', false ); + $tpl->set( 'userjsprev', false ); $tpl->set( 'jsvarurl', false ); @@ -1219,25 +1215,6 @@ class SkinTemplate extends Skin { return $this->getTitle()->getNamespaceKey(); } - /** - * @private - * @todo FIXME: Why is this duplicated in/from OutputPage::getHeadScripts()?? - */ - function setupUserJs( $allowUserJs ) { - global $wgJsMimeType; - wfProfileIn( __METHOD__ ); - - if( $allowUserJs && $this->loggedin ) { - if( $this->getTitle()->isJsSubpage() and $this->getOutput()->userCanPreview() ) { - # XXX: additional security check/prompt? - $this->userjsprev = '/*getRequest()->getText( 'wpTextbox1' ) . ' /*]]>*/'; - } else { - $this->userjs = self::makeUrl( $this->userpage . '/' . $this->skinname . '.js', 'action=raw&ctype=' . $wgJsMimeType ); - } - } - wfProfileOut( __METHOD__ ); - } - public function commonPrintStylesheet() { return false; } -- 2.20.1