Last modified: 2012-10-30 23:44:46 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 T42288, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 40288 - The scripts of some gadgets are not added to their Resource Loader modules on Portuguese Wikipedia (ext.gadget.foo is "empty")
The scripts of some gadgets are not added to their Resource Loader modules on...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Gadgets (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-16 23:20 UTC by Helder
Modified: 2012-10-30 23:44 UTC (History)
2 users (show)

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


Attachments

Description Helder 2012-09-16 23:20:26 UTC
I've created two pages with exactly the same code:
* https://pt.wikibooks.org/wiki/MediaWiki:Gadget-EnhancedSearch.js/Core.js
* https://pt.wikipedia.org/wiki/MediaWiki:Gadget-EnhancedSearch.js/Core.js
and defined one gadget in each project, both with the same definition:
* EnhancedSearchCore[ResourceLoader|rights=oculto]|EnhancedSearch.js/Core.js

The one at ptwikibooks correctly generates a module "ext.gadget.EnhancedSearchCore":
* https://bits.wikimedia.org/pt.wikibooks.org/load.php?debug=false&lang=pt&modules=ext.gadget.EnhancedSearchCore&skin=vector&version=20120916T221122Z&*
but the one on ptwiki is "empty":
* https://bits.wikimedia.org/pt.wikipedia.org/load.php?debug=false&lang=pt&modules=ext.gadget.EnhancedSearchCore&skin=vector&version=20120909T005652Z&*
More precisely, it contains only this code:
----
mw.loader.implement("ext.gadget.EnhancedSearchCore",function(){;},{},{});

/* cache key: ptwiki:resourceloader:filter:minify-js:7:afdac18b7c74164d7ddfb2546d8b3023 */
----

and as such it does nothing when we try to load it with mw.loader.load as a (minified) module:
https://pt.wikipedia.org/wiki/MediaWiki:Gadget-EnhancedSearch.js?diff=32178987

Why mw.loader.load gets an empty module on ptwiki?

Here are some extra examples:
* works:
https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.Topicon
* do not works:
https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.NewVillagePumpCore
Comment 1 Helder 2012-09-17 00:18:04 UTC
Creating a test at
https://pt.wikipedia.org/wiki/MediaWiki:Gadget-RL-test.js?oldid=32251404
with the code
console.log(123);
and defining a gadget with either of these lines
* RL-test[ResourceLoader|rights=hidden]|RL-test.js
* RL-test[ResourceLoader|rights=oculto]|RL-test.js
at
https://pt.wikipedia.org/wiki/MediaWiki:Gadgets-definition?diff=32251437

I was able to load the module correctly using
mw.loader.load('ext.gadget.RL-test');
and I saw "123" on Google Chrome's console. Also, the console.log comment appears at
https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.RL-test
as expected.

But mw.loader.load('ext.gadget.EnhancedSearchCore'); do not work (it should add some checkboxes at [[pt:Special:Search]], as it does when executed on ptwikibooks's search page), since the code is not here:
https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.EnhancedSearchCore
but is here:
https://bits.wikimedia.org/pt.wikibooks.org/load.php?modules=ext.gadget.EnhancedSearchCore
Comment 2 Krinkle 2012-09-17 11:45:46 UTC
I've purged them. Seems fine now. Not sure why it looked empty. In debug mode it was also fine.

Appears to be a caching issue. Perhaps you created the definition entry before the javascript page, and so the empty (non existent) page got into cache?
Comment 3 Helder 2012-09-17 21:55:02 UTC
As you can check at
https://pt.wikipedia.org/wiki/Special:Contribs/Rjclaudio?offset=20120909005857&target=Rjclaudio&limit=23&uselang=en
at first some existing JavaScript pages were moved
* MediaWiki:Gadget-Nova-esplanada.js --> MediaWiki:Gadget-NewVillagePump.js/Core.jsjs --> MediaWiki:Gadget-NewVillagePump.js/Core.js
* MediaWiki:Gadget-SVGPNG.js --> MediaWiki:Gadget-SVGPNG.js/Core.js
Only after this the definition was changed:
https://pt.wikipedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=prev&oldid=32157328
(this was the first time we had gadgets with names "NewVillagePumpCore", "EnhancedSearchCore" and "SVGPNGCore" respectively).
Then the last script was renamed:
* MediaWiki:Gadget-BuscaAprimorada.js --> MediaWiki:Gadget-EnhancedSearch.js/Core.js

The modules corresponding to the three gadgets were "empty", but two of them had their JS pages created /before/ the edit to its definition, and the other one was created /after/ being defined. Is this sufficient to discard the "defined before created" hypothesis? 


Right now the other two modules which we renamed are still empty:
1) https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.SVGPNGCore
----
mw.loader.implement("ext.gadget.SVGPNGCore",function(){;},{},{});

/* cache key: ptwiki:resourceloader:filter:minify-js:7:1d3a5dc1bab123e9cf7227f2ddfc35c9 */
----

2) https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.NewVillagePumpCore
----
mw.loader.implement("ext.gadget.NewVillagePumpCore",function(){;},{},{});

/* cache key: ptwiki:resourceloader:filter:minify-js:7:346ff6bd2ceb3628d57f92830f57b620 */
----
Comment 4 Helder 2012-09-23 18:17:07 UTC
(In reply to comment #2)
> I've purged them. Seems fine now. Not sure why it looked empty. In debug mode
> it was also fine.

The module you'd purged when you edited the JS page[1] is empty again[2]!!!
(we didn't touch it this time...)

[1] https://pt.wikipedia.org/wiki/MediaWiki:Gadget-EnhancedSearch.js/Core.js?diff=32254667
[2] https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.EnhancedSearchCore
Comment 5 Helder 2012-10-09 19:07:37 UTC
I think ResourceLoader is crazy. It returns random content at https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.EnhancedSearchCore
Some times the code of the gadget is replaced by "function(){;}" and if I keep reloading that page 50% of the time the code is there and the other 50% it is not (whithout editing any other related pages)
Comment 6 Helder 2012-10-09 19:17:02 UTC
The same randomness happens after I did a small edit on this one:
https://pt.wikipedia.org/w/index.php?title=MediaWiki:Gadget-SVGPNG.js/Core.js&diff=32510433

The content of 
https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.SVGPNGCore
keeps alternating between
----
mw.loader.implement("ext.gadget.SVGPNGCore",function(){(function($,mw){'use strict';function SVGThumbs(){var thumbu,svgAltSize,p,l,i,info,file=document.getElementById('file'),i18n={'en':'This image rendered as PNG in other sizes: ','pt':'Esta imagem pode ser renderizada em PNG em outros tamanhos: '};if(!file){return;}i18n['en-gb']=i18n.en;i18n['pt-br']=i18n.pt;mw.messages.set({'svg-thumbs-desc':i18n[mw.config.get('wgUserLanguage')]||i18n.en});thumbu=file.getElementsByTagName('IMG')[0].getAttribute('src');if(!thumbu){return;}svgAltSize=function(w,title){var path=thumbu.replace(/\/\d+(px-[^\/]+$)/,'/'+w+'$1'),a=document.createElement('A');a.setAttribute('href',path);a.appendChild(document.createTextNode(title));return a;};p=document.createElement('p');p.className='SVGThumbs';p.appendChild(document.createTextNode(mw.msg('svg-thumbs-desc')));l=[200,500,1000,2000];for(i=0;i<l.length;i++){p.appendChild(svgAltSize(l[i],l[i]+'px'));if(i<l.length-1){p.appendChild(document.createTextNode(', '));
}}p.appendChild(document.createTextNode('.'));info=$(file.parentNode).find('div.fullMedia').get(0);if(info){info.appendChild(p);}}if(mw.config.get('wgNamespaceNumber')===6&&mw.config.get('wgIsArticle')&&mw.config.get('wgTitle').match(/\.svg$/i)){$(SVGThumbs);}}(jQuery,mediaWiki));;},{},{});

/* cache key: ptwiki:resourceloader:filter:minify-js:7:1421d720ab6b220bea3b870ec442b54c */
----

and

----
mw.loader.implement("ext.gadget.SVGPNGCore",function(){;},{},{});

/* cache key: ptwiki:resourceloader:filter:minify-js:7:1d3a5dc1bab123e9cf7227f2ddfc35c9 */
----
Comment 7 Helder 2012-10-09 19:27:03 UTC
The module of the other gadget mentioned just keeps empty, even after a small edit like this:
https://pt.wikipedia.org/w/index.php?diff=32510516
and various reloads (+-20).

On the other hand, when I added "&BUG40288=CONFIRMED" to the URL, the code appeared:
https://bits.wikimedia.org/pt.wikipedia.org/load.php?modules=ext.gadget.NewVillagePumpCore&BUG40288=CONFIRMED
Comment 8 Helder 2012-10-20 03:31:05 UTC
We have one more script with the same problem:
https://bits.wikimedia.org/pt.wikipedia.org/load.php?debug=true&lang=pt-br&modules=ext.gadget.PagesForDeletionCore&only=scripts&skin=vector&version=20121018T124359Z&*
is empty, but it should have the same content of
http://pt.wikipedia.org/w/load.php?modules=ext.gadget.PagesForDeletionCore&only=scripts
which is the minified version of
https://pt.wikipedia.org/wiki/MediaWiki:Gadget-PagesForDeletion.js/Core.js

The code is only loaded if we use importScript instead of mw.loader.load:
https://pt.wikipedia.org/w/index.php?title=MediaWiki:Gadget-PagesForDeletion.js&diff=32672881
(but this defeats the idea of using RL for minification of the script)
Comment 9 Roan Kattouw 2012-10-20 03:49:25 UTC
I suspect this is because the JS page has a slash in its name, and the part after the slash isn't a language code. This should be fixed with the cleanup I committed a few weeks ago; this commit is in 1.21wmf2, so it will be rolled out to ptwiki on Wednesday. If the issue persists after Wednesday's deployment, please report back here and I'll investigate.
Comment 10 Andre Klapper 2012-10-29 08:50:43 UTC
mybugs.mail: Is this still a problem on ptwiki? (See comment 9.)
Comment 11 Helder 2012-10-30 23:44:46 UTC
It seems to be working. Closing for now.

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


Navigation
Links