Page MenuHomePhabricator

Fix faulty gadgets erroring with "Script error" on our test wikis (Catalan Wikipedia and mediawiki.org)
Open, Needs TriagePublic

Description

The following gadgets appear to be causing JS error for users that load them. I don't have stack traces for them right now because of T259369 but have been able to manually replicate a few.

This task tracks identifying the source of the problem and helping get them fixed.

Fixed?ScriptTest urlJS errorMaintainer
https://meta.wikimedia.org/wiki/User:Mike.lifeguard/blockOptions.jshttps://www.mediawiki.org/wiki/Topic:Vlxq3or3tf4p1ozvUncaught ReferenceError: wgCanonicalSpecialPageName is not defined
https://meta.wikimedia.org/w/index.php?title=User%3AMike.lifeguard%2FaddTools.js&action=raw&ctype=text/javascripthttps://www.mediawiki.org/wiki/Topic:Vlxq3or3tf4p1ozvUncaught TypeError: document.getElementById(...) is null
https://commons.wikimedia.org/w/index.php?title=MediaWiki%3AGadget-Cat-a-lot.jshttps://ca.wikipedia.org/w/index.php?title=Diccionari_descriptiu_de_la_llengua_catalana&action=edit(Uncaught ReferenceError: catALot is not defined)?
https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.jshttps://ca.wikipedia.org/w/index.php?title=Plantilla:Infotaula_eleccions/proves&action=editUncaught TypeError: regExpMatch is undefined [1]@Cacycle
https://meta.wikimedia.org/w/index.php?title=User:Xiplus/TwinkleGlobal.jshttps://ca.wikipedia.org/wiki/Usu%C3%A0ria_Discussi%C3%B3:AranyaUnknown@Xiplus
https://www.mediawiki.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.jshttps://ca.wikipedia.org/w/index.php?title=Usuari_Discussi%C3%B3:MarinaABC&action=submitUnknownUnknown
https://meta.wikimedia.org/w/index.php?title=MediaWiki:Wikiminiatlas.jshttps://ca.wikipedia.org/wiki/Mass%C3%ADs_de_la_MaladetaUnknownUnknown
https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-popups.jshttps://ca.wikipedia.org/wiki/Viquiprojecte:Doblatge_en_valenci%C3%A0UnknownUnknown
https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.jshttps://ca.wikipedia.org/wiki/Miriam_EscofetUnknown?

Replication steps

  1. Take the URL in column "script"
  2. Append &action=raw&ctype=text%2Fjavascript&maxage=2419200&smaxage=2419200 to the end of the URL and pass it to mw.loader.getScript eg.
mw.loader.getScript('https://commons.wikimedia.org/w/index.php?title=MediaWiki%3AGadget-Cat-a-lot.js%2Fca&action=raw&ctype=text%2Fjavascript&maxage=2419200&smaxage=2419200' );

[1] Stack trace

Uncaught TypeError: regExpMatch is undefined
    Find https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript:9982
    EditButton https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript:8163
    <anonymous> https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript line 4374 > eval:1
    EditButtonHandler https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript:4374
    TurnOn https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript:3699
    Setup https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript:2396
    Startup https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript:2080
    <anonymous> https://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript:19206
index.php:9982:13

Event Timeline

Jdlrobson renamed this task from Fix faulty gadgets being loaded on Catalan Wikipedia to Fix faulty gadgets erroring with "ScriptError" being loaded on Catalan Wikipedia.Fri, Jul 31, 7:39 PM
Jdlrobson created this task.
Jdlrobson updated the task description. (Show Details)Sat, Aug 1, 5:50 AM
Jdlrobson added a subscriber: Cacycle.
Jony added a subscriber: Jony.Sat, Aug 1, 8:56 AM
Jdlrobson updated the task description. (Show Details)Sat, Aug 1, 8:47 PM
Krinkle renamed this task from Fix faulty gadgets erroring with "ScriptError" being loaded on Catalan Wikipedia to Fix faulty gadgets erroring with "Script error" on Catalan Wikipedia.Sat, Aug 1, 9:20 PM
Nirmos added a subscriber: Nirmos.Tue, Aug 11, 5:20 AM

After a quick investigation, none of the following seem to be used anywhere in the cawiki MediaWiki namespace:
blockOptions
addTools
TwinkleGlobal

Nirmos added a comment.EditedTue, Aug 11, 6:56 AM

They aren't used anywhere in the cawiki User namespace either:
blockOptions
addTools
TwinkleGlobal

They are used on meta in users' global.js, though:
blockOptions
addTools
TwinkleGlobal

Why do some of the test urls go to mediawikiwiki if this task is about cawiki? For example the first one with blockOptions. If I enter

mw.loader.load( 'https://meta.wikimedia.org/w/index.php?title=User:Mike.lifeguard/blockOptions.js&action=raw&ctype=text/javascript' );

in the console on https://www.mediawiki.org/wiki/Topic:Vlxq3or3tf4p1ozv I get "Uncaught ReferenceError: wgCanonicalSpecialPageName is not defined", just as the task says, but that is because mediawikiwiki has turned off global JavaScript variables (T72470). That does not happen on cawiki.

Jdlrobson renamed this task from Fix faulty gadgets erroring with "Script error" on Catalan Wikipedia to Fix faulty gadgets erroring with "Script error" on our test wikis (Catalan Wikipedia and mediawiki.org).Tue, Aug 11, 2:47 PM