Page MenuHomePhabricator

Sometimes no js is loading on commons (CropTool gadget issue?)
Closed, ResolvedPublic

Description

Sometimes (50% of cases) no js is loading on commons, especially when viewing file description pages.

https://commons.wikimedia.org/wiki/Commons:Help_desk#Random_missing_HotCat_links

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 10 2016, 2:46 PM

[ - Operations; + Wikimedia-General-or-Unknown ]

When this happens, can you please check in your web browser's developer tools ('console' and/or 'network') if there are any related errors?. For more information please see:

- console output from Firefox when viewing a file when the problem occurred: https://commons.wikimedia.org/wiki/File:Pillang%C3%B3s_-_panoramio.jpg

One thing that stands out is:

Exception in module-execute in module ext.gadget.CropTool: load.php:176:576
TypeError: mw.Uri is not a constructor TypeError: mw.Uri is not a constructor
Stack trace:

Disabling the CropTool gadget in preferences seems to help.

Aklapper renamed this task from Sometimes no js is loading on commons to Sometimes no js is loading on commons (CropTool gadget issue?).Dec 11 2016, 6:07 PM

Try to load the page a few times, and you won't see gadgets loading.

I see nothing special (such as timeouts or huge coding errors) in the console.

I have more luck reproducing it with "fresh" files. Refreshing the page will fix it, and then it stays fixed when refreshed several more times. There's nothing special about that particular file I posted, it's quite easy for me to reproduce on a random file. Adding ?debug=true seems to fix it too.

matmarex closed this task as Resolved.EditedDec 11 2016, 9:39 PM
matmarex claimed this task.

The CropTool gadget was definitely missing a dependency. Fixed: https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=225909613&oldid=211657054

The issue was caused by this edit to the gadget: https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-CropTool.js&diff=203599240&oldid=118183121 (this was a while ago, I don't know why it only started causing problems now. Something else must have been loading mediawiki.Uri and now it doesn't need it, or the load order has changed.)

I'll follow up at the help desk too, that user might be having a separate problem.

@Ghouston: Your console log was very useful, thanks. Out of curiosity, it seems to also have a ton of other "errors" which really look like some sort of debugging warnings (e.g. "SyntaxError: test for equality (==) mistyped as assignment (=)?") – how do you even enable that?

Ghouston added a comment.EditedDec 12 2016, 3:58 AM

Thanks, that fixes it for me. I guess the load order was changing between the working and non-working versions, maybe depending on whether the files were cached.

I compared my console output with what I get in a new Firefox profile. Firstly I had CSS warnings turned on. But the JS messages come from setting javascript.options.strict to true in about:config. I have no idea when or why I did that, it was probably years ago.

This comment was removed by Ghouston.