Page MenuHomePhabricator

Providing an invalid template file in RL module definition causes silent failure
Closed, ResolvedPublic

Description

Author: jgonera

Description:
If you misspell the file name in Resources.php, the whole module will not be loaded without any error message.


Version: unspecified
Severity: normal

Details

Reference
bz56076

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:29 AM
bzimport set Reference to bz56076.

bingle-admin wrote:

Prioritization and scheduling of this bug is tracked on Mingle card https://wikimedia.mingle.thoughtworks.com/projects/mobile/cards/1329

Should be easy to do - we can just check the file path. Leave with me.

Actually it does check for non-existance of a file so I'm unclear what kind of failure do you want?

Should it load the entire module without that template? Isn't that worse?

If you look at the JavaScript for the module with an invalid template it looks like this:
/*
exception 'MWException' with message 'MFResourceLoaderModule::getTemplateScript: template file not found: "/Users/jrobson/Sites/w/extensions/MobileFrontend/templates/overlays/notificationz.html"' in /Users/jrobson/Sites/w/extensions/MobileFrontend/includes/modules/MFResourceLoaderModule.php:85
Stack trace:
#0 /Users/jrobson/Sites/w/extensions/MobileFrontend/includes/modules/MFResourceLoaderModule.php(145): MFResourceLoaderModule->getTemplateScript()
#1 /Users/jrobson/Sites/w/includes/resourceloader/ResourceLoader.php(755): MFResourceLoaderModule->getScript(Object(ResourceLoaderContext))
#2 /Users/jrobson/Sites/w/includes/resourceloader/ResourceLoader.php(517): ResourceLoader->makeModuleResponse(Object(ResourceLoaderContext), Array, Array)
#3 /Users/jrobson/Sites/w/load.php(43): ResourceLoader->respond(Object(ResourceLoaderContext))
#4 {main}
*/
mw.loader.state({"mobile.beta.common":"missing"});
/* cache key: my_wiki:resourceloader:filter:minify-js:7:81f0ab7a7bc627ae9c0157fe6df772e6 */

https://gerrit.wikimedia.org/r/91658
is an alternative approach but I'm not sure if it is any better.

Marking fixed as reporter merged the patch.