Last modified: 2011-04-06 22:06:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T21888, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19888 - allow wikibits.js to load without any required globals
allow wikibits.js to load without any required globals
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.16.x
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks: javascript
  Show dependency treegraph
 
Reported: 2009-07-23 04:29 UTC by Splarka
Modified: 2011-04-06 22:06 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Example patch of wikibits.js without global requirements (1.10 KB, patch)
2009-07-23 04:44 UTC, Splarka
Details

Description Splarka 2009-07-23 04:29:54 UTC
Currently wikibits.js breaks (causes JS errors) anytime someone has no javascript globals (no call to Skin::makeGlobalVariablesScript). There are currently 3 globals fetched on the assumption that they are defined. It would be nice to have it not puke and die (and not define any mediawiki js functions at all, and often abort all further javascript on a page) when/if they're missing. 

This can happen when someone is using a custom skin that wasn't upgraded along with MediaWiki (either they recently upgraded, or grabbed a skin not meant for the version they have). Several times people have complained of javascript problems with their skin, due to their skin sucking. It wouldn't be so bad, except it breaks /all/ javascript for them, until they can either fix the skin themselves, or find the maintainer (if one exists) to fix it.

Also, wikibits.js might be a useful js to include with action=render for things like custom mini static dumps, and such.
Comment 1 Splarka 2009-07-23 04:44:28 UTC
Created attachment 6384 [details]
Example patch of wikibits.js without global requirements

Here is an example patch to make wikibits.js not fail without globals.

The stylepath change is a bit concerning, but a null stylepath here shouldn't really cause problems (or rather, any /more/ problems than that of the JS being totally broken).

A better solution would be to replace cases of 'stylepath' calls in sorttable with  a dummy variable assigned to the value of stylepth (or null if undefined), maybe.
Comment 2 Laurence 'GreenReaper' Parry 2009-09-03 03:59:16 UTC
Random note before I forget - the stylepath line should be either:
if (typeof stylepath == 'undefined') var stylepath = "";
or this shorter version (from Splarka):
var stylepath = stylepath || "";
Comment 3 Krinkle 2011-04-06 22:06:51 UTC
* wikbits.js is already deprecated, up to be quarantined in 1.19 into mw.legacy
* global wg* variables are also deprecated and moved to mw.config, currently still shadowed to the global space as well for backwards compatibility. All usage in core is or soon will be replaced.

One of the advantages to mw.config is that it wont cause any 'undefined' errors (takes care of that internally through the mw.Map() constructor)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links