How exactly did you try it: mw.loader.using( 'resource.name', function() {
... } ) ?

On Tue, Sep 16, 2014 at 3:00 PM, Jack Phoenix <[email protected]>
wrote:

> Hi all,
>
> A few days ago I was fiddling around with my Labs instance [1], which
> serves as a development/testing/showcase area for social tools [2]. Somehow
> I ended up on Special:ViewPoll [3] and got curious as to why a JavaScript
> hover effect (mouseover/mouseout) didn't work on that page -- I was sure it
> used to work just fine not that long time ago. Without thinking that much
> about it, I clicked on the one and only poll listed on the page [4], and
> turns out the whole Poll: page is about as broken as it can be due to a
> JavaScript error.
>
> After a while of debugging, consultation and more debugging, turned out
> that my local development setup had $wgResourceLoaderDebug = true; in its
> LocalSettings.php, which apparently hides some race conditions or something
> like that. The Labs instance tries to be a more faithful representation of
> a production wiki, and as such, it doesn't have this setting enabled and
> hence why the problem manifests there.
>
> PollNY itself is a rather old extension, as most original social tools are
> (see the MW.org page [2] for details), and as such, it likely has some
> non-optimal code and it's also gone through plenty of iterations in the
> past. As a matter of fact, when porting PollNY to use ResourceLoader, it
> seems I myself made some suboptimal choices, such as bundling both CSS and
> JS into the same module and loading this module with 'position' => 'top'.
>
> Anyway, after decoupling the main CSS into its own module (locally, haven't
> submitted this to git yet), tweaking the callers and whatnot, I was able to
> get the hover effects on Special:ViewPoll to work as intended. While this
> is definitely a step forward, the actual problem with pages in the Poll:
> namespace still persists.
>
> PollNY has two JS files, LightBox.js and Poll.js. LightBox.js contains a
> lightbox implementation and technically it's not needed for stuff like the
> <pollembed> tag etc. and it should only be loaded on Poll: pages. Poll.js,
> on the other hand, is basically needed everywhere where there is PollNY;
> special pages, pages that embed a poll via the <pollembed> tag, Poll:
> pages...
>
> Now, the actual issue is that no matter what I do, I get a "TypeError:
> 'LightBox' is not defined" on Poll: pages (such as [4]). In the git master
> version, this is due to the aforementioned race condition: line 466 of
> Poll.js tries to use mw.loader.load() to load the LightBox RL module if
> it's not already loaded, but in RL's production mode this fails, because,
> as I've been told by those with more intimate knowledge of ResourceLoader
> and its inner workings, mw.loader.load is asynchronous. I've tried
> mw.loader.using, but it doesn't seem to do anything as far as fixing the
> issue goes.
>
> Please let me know if you're able to help me out with this; I've ran out of
> ideas.
>
> [1] http://social-tools.wmflabs.org/
> [2] https://www.mediawiki.org/wiki/Social_tools
> [3] http://social-tools.wmflabs.org/wiki/Special:ViewPoll
> [4] http://social-tools.wmflabs.org/wiki/Poll:How_is_the_weather_today%3F
>
>
> Thanks and regards,
> --
> Jack Phoenix
> MediaWiki developer
> _______________________________________________
> Wikitech-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l




-- 
Best regards,
Max Semenik ([[User:MaxSem]])
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to