Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/295770
Change subject: Don't abuse SkinPreloadExistence to set mobile target ...................................................................... Don't abuse SkinPreloadExistence to set mobile target Instead set the mobile target inside onBeforePageDisplay hook. This is a more natural place for this anyway, given the other changes inside this hook. Bug: T136651 Change-Id: I7c0de0691fd72d5a80c0c2aed12284dcca7402f7 --- M extension.json M includes/MobileFrontend.hooks.php 2 files changed, 5 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/70/295770/1 diff --git a/extension.json b/extension.json index dc29546..3269dd9 100644 --- a/extension.json +++ b/extension.json @@ -1941,9 +1941,6 @@ "ResourceLoaderGetLessVars": [ "MobileFrontendHooks::onResourceLoaderGetLessVars" ], - "SkinPreloadExistence": [ - "MobileFrontendHooks::onSkinPreloadExistence" - ], "ThumbnailBeforeProduceHTML": [ "MobileFrontendHooks::onThumbnailBeforeProduceHTML" ], diff --git a/includes/MobileFrontend.hooks.php b/includes/MobileFrontend.hooks.php index 05e9c63..36eb347 100644 --- a/includes/MobileFrontend.hooks.php +++ b/includes/MobileFrontend.hooks.php @@ -399,23 +399,6 @@ } /** - * SkinPreloadExistence hook handler - * Disables TOC in output before it grabs HTML - * @see https://www.mediawiki.org/wiki/Manual:Hooks/SkinPreloadExistence - * - * @param Title[] $titles - * @param Skin $skin - * @return bool - */ - public static function onSkinPreloadExistence( array &$titles, Skin $skin ) { - $context = MobileContext::singleton(); - if ( $context->shouldDisplayMobileView() && !$context->isBlacklistedPage() ) { - $skin->getOutput()->setTarget( 'mobile' ); - } - return true; - } - - /** * ResourceLoaderGetConfigVars hook handler * This should be used for variables which: * - vary with the html @@ -858,6 +841,11 @@ // in mobile view: always add vary header $out->addVaryHeader( 'Cookie' ); + // set the mobile target + if ( !$context->isBlacklistedPage() ) { + $out->setTarget( 'mobile' ); + } + // Allow modifications in mobile only mode Hooks::run( 'BeforePageDisplayMobile', [ &$out, &$sk ] ); -- To view, visit https://gerrit.wikimedia.org/r/295770 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7c0de0691fd72d5a80c0c2aed12284dcca7402f7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits