Last modified: 2013-06-10 23:32:28 UTC
I created "MediaWiki:Gadget-someBug.js" on testwiki with ---- mw.loader.using([ 'mediawiki.util', 'jquery.placeholder', 'jquery.spinner' ], function(){ console.log( 'Ok! All modules were loaded!', arguments ) }, function(){ console.log( 'Ops! Error with mw.loader.using! ', arguments ) }); ---- and then enabled <gadget-someBug> at https://test.wikipedia.org/wiki/Special:Preferences#mw-prefsection-gadgets After that, if I go to https://test.wikipedia.org/wiki/MediaWiki:Gadget-someBug.js?action=edit&debug=1&uselang=en&useskin=vector using Google Chrome 22.0.1229.94. my console do not show any message from the gadget (and no error either). This means none of the callbacks were called. My common.js was empty during the tests. I also tested doing one of the following changes in the URL above: * action=history: bugged; * uselang=fr: bugged; * useskin=monobook: bugged; * debug=0: Ok! All modules were loaded! [];
FYI: testwiki is running MediaWiki 1.21wmf2 (0b3ede6)
Doing the same tests on my local copy of MW I always got "Ok! All modules were loaded! []". I also tested putting the code in "MediaWiki:Common.js" instead of into a gadget, and it worked in each test (both on testwiki and in my local wiki): https://test.wikipedia.org/w/index.php?title=MediaWiki:Common.js&diff=148427&oldid=148367 So, maybe this is specific to the gadgets extension (or related to the way modules from MW extensions in general interact with other modules)
(In reply to comment #2) > So, maybe this is specific to the gadgets extension (or related to the way > modules from MW extensions in general interact with other modules) Ok, it is not Gadget related. It is also bugged if I use the "withJS" url param as in: https://test.wikipedia.org/wiki/Bug_41453?action=purge&debug=1&uselang=fr&useskin=monobook&withJS=MediaWiki%3AGadget-someBug.js
This is more broken than I though... :-( I tried again on my local copy of MW (after using "git pull origin master"), and I randomly see either: * No callbacks being executed; * The ready callback. And this was NOT in debug mode. Also, I added the line mw.loader.load('ext.gadget.bug41453b'); to the gadget and created "MediaWiki:Gadget-bug41453b.js". Then, in the exact same situations where the mw.loader.using failed to execute the callbacks, mw.loader.load didn't load the module.
Created attachment 11336 [details] Adding some console.log commands So, I've added some console.log commands in mw.loader code (see the patch) and got the following on Google Chrome when the bug happened: mw.loader.implement: user.options load.php:159 mw.loader > execute: user.options load.php:152 mw.loader.implement: user.tokens load.php:159 mw.loader > execute: user.tokens load.php:152 mw.loader.load: mediawiki.page.startup,mediawiki.legacy.wikibits,mediawiki.legacy.ajax load.php:161 mw.loader > request: jquery.client,jquery.cookie,jquery.mwExtension,mediawiki.notify,mediawiki.util,mediawiki.page.startup,mediawiki.legacy.wikibits,mediawiki.legacy.ajax load.php:154 mw.loader.work: [object Arguments] load.php:155 mw.loader.implement: jquery.client load.php:159 mw.loader > execute: jquery.client load.php:152 mw.loader.implement: jquery.cookie load.php:159 mw.loader > execute: jquery.cookie load.php:152 mw.loader.implement: jquery.mwExtension load.php:159 mw.loader > execute: jquery.mwExtension load.php:152 mw.loader.implement: mediawiki.legacy.ajax load.php:159 mw.loader.implement: mediawiki.legacy.wikibits load.php:159 mw.loader.implement: mediawiki.notify load.php:159 mw.loader > execute: mediawiki.notify load.php:152 mw.loader.implement: mediawiki.util load.php:159 mw.loader > execute: mediawiki.util load.php:152 mw.loader > execute: mediawiki.legacy.wikibits load.php:152 mw.loader > execute: mediawiki.legacy.ajax load.php:152 mw.loader.implement: mediawiki.page.startup load.php:159 mw.loader > execute: mediawiki.page.startup load.php:152 mw.loader.load: mediawiki.user,mediawiki.page.ready,mediawiki.page.watch.ajax,mediawiki.searchSuggest,mediawiki.hidpi,ext.gadget.bug41453,ext.vector.collapsibleNav,ext.vector.collapsibleTabs load.php:161 mw.loader > request: jquery.cookie,jquery.client,jquery.mwExtension,mediawiki.notify,mediawiki.util,mediawiki.api,user.options,user.tokens,mediawiki.user,jquery.checkboxShiftClick,jquery.makeCollapsible,jquery.placeholder,jquery.mw-jump,mediawiki.page.ready,mediawiki.page.startup,mediawiki.api.watch,mediawiki.page.watch.ajax,jquery.highlightText,jquery.autoEllipsis,jquery.suggestions,mediawiki.searchSuggest,jquery.hidpi,mediawiki.hidpi,ext.gadget.bug41453,jquery.tabIndex,ext.vector.collapsibleNav,jquery.delayedBind,jquery.collapsibleTabs,ext.vector.collapsibleTabs load.php:154 mw.loader.work: [object Arguments] load.php:155 mw.loader.implement: ext.gadget.bug41453 load.php:159 mw.loader > execute: ext.gadget.bug41453 load.php:152 mw.loader.using: mediawiki.util,jquery.placeholder,jquery.spinner ready=function (){console.warn('Ready callback was executed.',arguments);} error=function (){console.warn('Error callback was executed.',arguments);} load.php:160 mw.loader.using: need to request jquery.client,jquery.cookie,jquery.mwExtension,mediawiki.notify,mediawiki.util,jquery.placeholder,jquery.spinner load.php:160 mw.loader > request: jquery.client,jquery.cookie,jquery.mwExtension,mediawiki.notify,mediawiki.util,jquery.placeholder,jquery.spinner load.php:154 mw.loader.work: [object Arguments] load.php:155 [!] mw.loader.using was executed. What about the callbacks? load.php:1 mw.loader.load: ext.gadget.bug41453b load.php:161 mw.loader > request: ext.gadget.bug41453b load.php:154 mw.loader.work: [object Arguments] load.php:155 [!] And what about mw.loader.loader? Did it load the other gadget? load.php:1 mw.loader.implement: jquery.autoEllipsis load.php:159 mw.loader.implement: jquery.checkboxShiftClick load.php:159 mw.loader > execute: jquery.checkboxShiftClick load.php:152 mw.loader.implement: jquery.collapsibleTabs load.php:159 mw.loader.implement: jquery.delayedBind load.php:159 mw.loader > execute: jquery.delayedBind load.php:152 mw.loader > execute: jquery.collapsibleTabs load.php:152 mw.loader.implement: jquery.hidpi load.php:159 mw.loader > execute: jquery.hidpi load.php:152 mw.loader.implement: jquery.highlightText load.php:159 mw.loader > execute: jquery.highlightText load.php:152 mw.loader > execute: jquery.autoEllipsis load.php:152 mw.loader.implement: jquery.makeCollapsible load.php:159 mw.loader > execute: jquery.makeCollapsible load.php:152 mw.loader.implement: jquery.mw-jump load.php:159 mw.loader > execute: jquery.mw-jump load.php:152 mw.loader.implement: jquery.placeholder load.php:159 mw.loader > execute: jquery.placeholder load.php:152 mw.loader.implement: jquery.suggestions load.php:159 mw.loader > execute: jquery.suggestions load.php:152 mw.loader.implement: jquery.tabIndex load.php:159 mw.loader > execute: jquery.tabIndex load.php:152 mw.loader.implement: mediawiki.api load.php:159 mw.loader > execute: mediawiki.api load.php:152 mw.loader.implement: mediawiki.hidpi load.php:159 mw.loader > execute: mediawiki.hidpi load.php:152 mw.loader.implement: mediawiki.searchSuggest load.php:159 mw.loader > execute: mediawiki.searchSuggest load.php:152 mw.loader.implement: mediawiki.user load.php:159 mw.loader > execute: mediawiki.user load.php:152 mw.loader.implement: mediawiki.api.watch load.php:159 mw.loader > execute: mediawiki.api.watch load.php:152 mw.loader.implement: mediawiki.page.ready load.php:159 mw.loader > execute: mediawiki.page.ready load.php:152 mw.loader.implement: mediawiki.page.watch.ajax load.php:159 mw.loader > execute: mediawiki.page.watch.ajax load.php:152 mw.loader.implement: ext.vector.collapsibleNav load.php:159 mw.loader > execute: ext.vector.collapsibleNav load.php:152 mw.loader.implement: ext.vector.collapsibleTabs load.php:159 mw.loader > execute: ext.vector.collapsibleTabs
In the test above, the gadgets were defined as follows: [[MediaWiki:Gadgets-definition]] * bug41453[ResourceLoader]|bug41453.js * bug41453b[ResourceLoader]|bug41453b.js [[MediaWiki:Gadget-bug41453.js]] // See https://bugzilla.wikimedia.org/show_bug.cgi?id=41453 mw.loader.using([ 'mediawiki.util', 'jquery.placeholder', 'jquery.spinner' ], function(){ console.warn( 'Ready callback was executed.', arguments ); }, function(){ console.warn( 'Error callback was executed.', arguments ); }); console.warn( 'mw.loader.using was executed. What about the callbacks?' ); mw.loader.load('ext.gadget.bug41453b'); console.warn( 'And what about mw.loader.loader? Did it load the other gadget?' ); [[MediaWiki:Gadget-bug41453b.js]] console.warn('The other gadget was loaded by mw.loader.load');
(In reply to comment #5) In the cases where the modules are loaded correctly, the only difference in the console was that there was the following lines after the ones from comment 5: (... log from comment 5) mw.loader.implement: jquery.spinner load.php:159 mw.loader > execute: jquery.spinner load.php:152 Ready callback was executed. [] load.php:1 mw.loader.implement: ext.gadget.bug41453b load.php:159 mw.loader > execute: ext.gadget.bug41453b load.php:152 The other gadget was loaded by mw.loader.load
A few minutes later I decided to check the status of each of the modules the gadget tries to load and got: mw.loader.getState('mediawiki.util') "ready" mw.loader.getState('jquery.placeholder') "ready" mw.loader.getState('jquery.spinner') "loading" mw.loader.getState('ext.gadget.bug41453b') "loading" Why does "jquery.spinner" and "ext.gadget.bug41453b" never finishes loading?
I spent a few minutes trying to reproduce this in different environments but I can't reproduce any of it. Can formulate a list of reproduction steps (as short and specific as possible)?
(In reply to comment #9) > Can formulate a list of reproduction steps (as short and specific as possible)? 1) Set $wgResourceLoaderDebug = false; 2) Create the gadgets as in comment 6 and enable <gadget-bug41453>; 3) Click on the wiki's logo 4) Open the console 5) Repeat (3) a few times until the bug happens (right now it is happening ~50% of the times I reload the page), i.e., there is no "Ready callback" message.
Here are a few cases where I wasn't able to reproduce it in my local wiki either: * On Firefox 16.0.2: ** $wgResourceLoaderDebug = true ** $wgResourceLoaderDebug = false * On Chrome 22.0.1229.94 ** $wgResourceLoaderDebug = true ** $wgResourceLoaderDebug = false, with cache disabled (CTRL+SHIFT+J > Settings > Disable cache) ** $wgResourceLoaderDebug = false, using CTRL+SHIFT+R (or SHIFT+RightClick+Reload) instead of clicking in the logo to reload the page ** $wgResourceLoaderDebug = false, removing the 'jquery.spinner' from the command mw.loader.using in the gadget. The ready callback was executed, but the mw.loader.load command didn't load the module "ext.gadget.bug41453b"
Can you still reproduce this?
Helder: Can you still reproduce this?
https://test.wikipedia.org/wiki/Special:Version is now running 1.22wmf6 (1b62507) and I wasn't able to reproduce the bug there using Google Chrome 27.0.1453.110.