Last modified: 2014-11-17 10:35:47 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 T37077, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35077 - mwCustomEditButtons broken: edit toolbar does not update if site JS is slow to load
mwCustomEditButtons broken: edit toolbar does not update if site JS is slow t...
Status: RESOLVED DUPLICATE of bug 31511
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
1.19
All All
: High normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-09 03:56 UTC by Tim Starling
Modified: 2014-11-17 10:35 UTC (History)
4 users (show)

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


Attachments

Description Tim Starling 2012-03-09 03:56:44 UTC
On the English Wikipedia, the old edit toolbar sometimes shows only the default buttons. The buttons which are added by [[MediaWiki:Common.js/edit.js]] with mwCustomEditButtons.push() are not shown. 

Testing with Firebug supports the theory that this is due to mediawiki.toolbar.onReady() being called before [[MediaWiki:Common.js/edit.js]] finishes loading (it is loaded with importScript()).
Comment 1 Tim Starling 2012-03-09 03:58:06 UTC
Adding CCs for Roan and Krinkle, I'm hoping I can avoid having to fix this one myself.
Comment 2 Krinkle 2012-03-09 04:53:22 UTC
Didn't we solve this already?

The global array can't be trusted, never could and never can. It's looked at once at a certain point (when onReady fires) and after that it's gone. Therefor mw.toolbar.addButton was introduced.

user scripts and site scripts do load before onReady afaik (otherwise mwCustomEditButtons wouldn't work at all). But this one is called through importScript from MediaWiki:Common.js, separate http request.

I'm not sure what else we can do about this. Changing the script to use mw.toolbar.addButton will fix it.
Comment 3 Krinkle 2012-03-09 04:56:05 UTC
There's a catch in this particular case though. The items added to the array on [[MediaWiki:Common.js/edit.js]] are not intended to be added to the toolbar per se.
It's depending on the ability for the user script to clear the array, however this hasn't worked stability for quite a while.

In general using mw.toolbar.addButton fixes it, but in this particular case that's not a solution, but that's a problem with that script and a use case I don't think can be expected to work.

I've posted 2 suggestions on that talk page: https://en.wikipedia.org/wiki/MediaWiki_talk:Common.js/edit.js#MediaWiki:Common.js.2Fedit.js:_mw.toolbar.addButton

https://en.wikipedia.org/wiki/MediaWiki_talk:Common.js/edit.js#MediaWiki:Common.js.2Fedit.js:_Opt-out
Comment 4 Krinkle 2012-03-09 05:03:47 UTC
see bug 31511 and bug 33952
Comment 5 Krinkle 2012-03-09 05:04:02 UTC

*** This bug has been marked as a duplicate of bug 31511 ***

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


Navigation
Links