Page MenuHomePhabricator

"Unknown dependency" error should not stop mw.loader.load from loading other modules
Closed, ResolvedPublic

Description

After some reports of broken gadgets on Portuguese Wikipedia, I noticed that they were failing because one of the default gadgets was defined by

  • Topicon[ResourceLoader|default|dependencies=jquery.mwPrototypes]|Topicon.js|Topicon.css

which worked fine on MW 1.18, and then stoped working on MW 1.19 because the module was renamed to "jquery.mwExtension" on r94227. This was fixed by updating the definition:
https://pt.wikipedia.org/w/index.php?title=MediaWiki%3AGadgets-definition&diff=29150779&oldid=29083316

But the point is: the unknown dependency was breaking not only that (default) script, but other gadgets as well.

You can check this by defining a dummy gadget by means of a line such as

  • bug-test[ResourceLoader|dependencies=foo.bar]|bug-test.js

https://pt.wikibooks.org/w/index.php?title=MediaWiki%3AGadgets-definition&action=historysubmit&diff=233968&oldid=233722
and enable it together with some other gadget (e.g. the UTCLiveClock, which is working fine). There will be an error like this:

Uncaught Error: Unknown dependency: foo.bar

and the other gadget won't work.


Version: 1.19
Severity: normal

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:15 AM
bzimport set Reference to bz34853.

Rephrasing bug and moving to MediaWiki core > ResourceLoader.

The gadgets (and other modules as well), are loaded from the html page with mw.loader.load(), passing it an array of module names. Among them gadget.Topicon and what not.

By default modules loaded in the same batch are related (e.g. a dependency resolution, or a call to mw.loader.using() ). But calls to mw.loader.load() shouldn't be treated like that.

Not a lot of gadgets on third party wikis, so I don't think this is going to be a major blocker for 1.19 tarball release. Adjusting milestone.

I have seen this in 1.19, but, yes, not a huge issue. Bumping to nebulous future.

Two years ago, Krinkle assigned this ticket to Roan and set the status to ASSIGNED.

Roan: Are you still working (or still plan to work) on this issue? In case you do not plan to work on this issue anymore, should the assignee be set back to default and the bug status changed from ASSIGNED to NEW/UNCONFIRMED? Thanks.

(In reply to Mark A. Hershberger from comment #3)

not a huge issue.

-> Changing priority from high to normal.

Krinkle renamed this task from mw.loader.load should (continue to) load other modules even if one of them doesn't make it to "Unknown dependency" error should not stop mw.loader.load from loading other modules.Apr 10 2015, 7:46 PM
Krinkle removed Catrope as the assignee of this task.
Krinkle removed a project: Future-Release.
Krinkle set Security to None.

To clarify: mw.loader.load is used when unrelated modules are loaded in a batch (such as by OutputPage). It already takes care of treating them separately and errors in one do not stop others from loading. mw.loader.using() on the other hand is used when loading modules together, providing a final callback. There, if one fails, the sequence is aborted.

The problem is that a specific type of error, "Unknown dependency", is able to escape this regular flow in mw.loader.load and thus loading is still aborted for the other modules in the same batch.

Change 364005 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] mw.loader: Skip modules in load() with unknown dependencies

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

"resolutinos" → "resolutions" (line 1189)

"stil" → "still" (line 2048)

"resolutinos" → "resolutions" (line 1189)

"stil" → "still" (line 2048)

Thanks! Fixed.

Will there be a message in the browser console or on Special:Gadgets like "Module ${ Foo } failed to load because of unknown dependencies"?

Will there be a message in the browser console or on Special:Gadgets [..]

It'll be in the browser console.

Change 364005 merged by jenkins-bot:
[mediawiki/core@master] mw.loader: Skip modules in load() with unknown dependencies

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

Krinkle edited projects, added Performance-Team; removed Patch-For-Review.