Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/118944

Change subject: Don't try to (inline load) ext.scribunto if it isn't registered
......................................................................

Don't try to (inline load) ext.scribunto if it isn't registered

This module doesn't exist on mobile, so don't try to load it there
(which will produce an exception).

Bug: 59808
Change-Id: Ifad7edb508c1f740a109e8f5c1656e4c7841ab13
---
M common/Hooks.php
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/44/118944/1

diff --git a/common/Hooks.php b/common/Hooks.php
index bd3ae8f..8565acc 100644
--- a/common/Hooks.php
+++ b/common/Hooks.php
@@ -365,9 +365,13 @@
         */
        public static function parserOutputHook( $outputPage, $parserOutput ) {
                $outputPage->addModules( 'ext.scribunto' );
-               $outputPage->addInlineScript( 'mw.loader.using("ext.scribunto", 
function() {' . 
-                       Xml::encodeJsCall( 'mw.scribunto.setErrors', array( 
$parserOutput->scribunto_errors ) )
-                       . '});' );
+               $outputPage->addInlineScript(
+                       // Only run the following if the ext.scribunto module 
is registered (which it isn't on mobile). Bug 59808
+                       'mw.loader.getState("ext.scribunto") && ' .
+                       'mw.loader.using("ext.scribunto", function() {' .
+                               Xml::encodeJsCall( 'mw.scribunto.setErrors', 
array( $parserOutput->scribunto_errors ) )
+                       . '});'
+               );
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/118944
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifad7edb508c1f740a109e8f5c1656e4c7841ab13
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Hoo man <h...@online.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to