Page MenuHomePhabricator

Mobileview complains about "Uncaught Error: Unknown dependency: mediawiki.api.parse"
Closed, ResolvedPublic

Description

Some insights as to what's happening here would be appreciated.

The extension specifies:

	$GLOBALS['wgResourceModules']['ext.scite.tooltip'] = array(
		...
		'localBasePath' => __DIR__ ,
		'remoteExtPath' => end( $extensionPathParts ),
		'dependencies'  => array(
			'ext.scite.styles',
			'mediawiki.api.parse'
		),
		'targets' => array(
			'mobile',
			'desktop'
		)
	);

The declared ext.scite.styles dep. is correctly loaded as well as mediawiki.api [0] but in "&mobileaction=toggle_view_mobile" 'mediawiki.api.parse is not and complains consistently about [1]:

Uncaught Error: Unknown dependency: mediawiki.api.parse

sortDependencies @ load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=20150626T…:156sortDependencies @ load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=20150626T…:157(anonymous function) @ load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=20150626T…:157jQuery.extend.each @ load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=20150626T…:5resolve @ load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=20150626T…:157mw.loader.load @ load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=20150626T…:169(anonymous function) @ index.php?title=Example/PMC3680174/1&mobileaction=toggle_view_mobile:87

Tested on:
Product Version
MediaWiki 1.25.1
PHP 5.6.8 (apache2handler)
MySQL 5.6.24
MobileFrontend REL1_25

[0] https://cloud.githubusercontent.com/assets/1245473/8536824/aeda0092-2456-11e5-8da9-008acaa442fb.png

[1] https://cloud.githubusercontent.com/assets/1245473/8536831/c188e050-2456-11e5-9b17-abcc8ef7370f.png

Details

Related Gerrit Patches:

Event Timeline

mwjames created this task.Jul 7 2015, 2:39 AM
mwjames raised the priority of this task from to Needs Triage.
mwjames updated the task description. (Show Details)
mwjames added a project: Mobile.
mwjames added a subscriber: mwjames.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 7 2015, 2:39 AM
Krenair added a subscriber: Krenair.Jul 7 2015, 2:43 AM

Hmm. Does mediawiki.api.parse need mobile listed as a target?

MobileFrontend ?? (cloned via git but really guys a number would be nice)

Use the commit hash?

Restricted Application added a project: Readers-Web-Backlog. · View Herald TranscriptJul 7 2015, 2:43 AM

Surely you could at least use git rev-parse --short HEAD?

Surely you could at least use git rev-parse --short HEAD?

which returns "fatal: Not a git repository (or any of the parent directories): .git" and I remembered that for once I used mw.org's [0] which means it is the version bundled with 1.25 (still doesn't explain the version it is used with but whatever)

[0] https://www.mediawiki.org/wiki/Special:ExtensionDistributor/MobileFrontend

Legoktm added a subscriber: Legoktm.Jul 7 2015, 3:42 AM

Surely you could at least use git rev-parse --short HEAD?

which returns "fatal: Not a git repository (or any of the parent directories): .git" and I remembered that for once I used mw.org's [0] which means it is the version bundled with 1.25 (still doesn't explain the version it is used with but whatever)
[0] https://www.mediawiki.org/wiki/Special:ExtensionDistributor/MobileFrontend

ExtensionDistributor includes a file named "version" with the tarball which should contain the git sha1 the tarball was based on.

ExtensionDistributor includes a file named "version" with the tarball which should contain the git sha1 the tarball was based on.

I actually wanted to know about "Uncaught Error: Unknown dependency: mediawiki.api.parse"" not discuss on whether it has a version or not but to satisfy the curious it shows "MobileFrontend: REL1_252015-04-21T22:15:25c193468".

I actually wanted to know about "Uncaught Error: Unknown dependency: mediawiki.api.parse"" not discuss on whether it has a version or not

Hmm. Does mediawiki.api.parse need mobile listed as a target?

phuedx updated the task description. (Show Details)Jul 8 2015, 10:07 AM
phuedx set Security to None.
Jhernandez triaged this task as Normal priority.Jul 8 2015, 10:07 AM
Jhernandez moved this task from Incoming to 2014-15 Q4 on the Readers-Web-Backlog board.
Jhernandez added a subscriber: Jhernandez.

Change 223549 had a related patch set uploaded (by Krinkle):
mediawiki.api: Include 'mobile' target in mediawiki.api.parse module

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

Krinkle added a subscriber: Krinkle.Jul 8 2015, 1:50 PM

The immediate cause is the SemanticCite extension adding a dependency on the mediawiki.api.parse module.

However the underlying cause is that SemanticCite doesn't know (and shouldn't need to know) that its modules are loaded in MobileFrontend as well. The problem being that mobile has an isolated ResourceLoader realm ("target") where by default, modules do not exist.

The immediate cause is the SemanticCite extension adding a dependency on the mediawiki.api.parse module.

Without the mediawiki.api.parse dependency I would have no access to the api.parse function since this would cause a "Uncaught TypeError: api.parse is not a function".

However the underlying cause is that SemanticCite doesn't know (and shouldn't need to know) that its modules are loaded in MobileFrontend as well. The problem being that mobile has an isolated ResourceLoader realm ("target") where by default, modules do not exist.

Thanks

Would be marvellous the see this back-ported but then again I can fix this on my test system to go about to finalize our tests.

Change 223549 merged by jenkins-bot:
mediawiki.api: Include 'mobile' target in mediawiki.api.parse module

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