Quantcast

[MediaWiki-l] mw.util not loading with RL

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[MediaWiki-l] mw.util not loading with RL

Huji Lee
Hi

This is an issue I am experiencing on Persian Wikipedia (FAWP) for the last
couple of weeks. I have replicated it in different machines, and after
clearing the cache (or using incognito). I have replicated it in Firefox
and in Chrome.

When you open a page, some times certain widgets (e.g. Twinkle) or
user-specific JS scripts don't load. Refreshing the page will fix it 99% of
the time (that 1% requires refreshing 2 or 3 times).

Looking at the console shows an error that indicates "mw.util" is not
defined. See the error message in Firefox[1] and Chrome[2] But because none
of the scripts have changed recently, to me it means somehow that mw.util
is not loaded *some of the time*.

The problem manifests itself mostly when you open a tab in the background
(i.e. you middle-click a link), and especially when I open several tabs in
the background.

If I turn ResourceLoader off, the error does not occur. So I am thinking it
has to do with RL. Any ideas on the next steps to investigate this are
appreciated.

Huji

[1] https://commons.wikimedia.org/wiki/File:Firefox-mw.util-error.png
[2] https://commons.wikimedia.org/wiki/File:Chrome-mw.util-error.png
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Amir Ladsgroup
It's already announced that this won't be loaded by default anymore. You
need to add it as a dependency.

Best

On Fri, May 19, 2017, 5:54 PM Huji Lee <[hidden email]> wrote:

> Hi
>
> This is an issue I am experiencing on Persian Wikipedia (FAWP) for the last
> couple of weeks. I have replicated it in different machines, and after
> clearing the cache (or using incognito). I have replicated it in Firefox
> and in Chrome.
>
> When you open a page, some times certain widgets (e.g. Twinkle) or
> user-specific JS scripts don't load. Refreshing the page will fix it 99% of
> the time (that 1% requires refreshing 2 or 3 times).
>
> Looking at the console shows an error that indicates "mw.util" is not
> defined. See the error message in Firefox[1] and Chrome[2] But because none
> of the scripts have changed recently, to me it means somehow that mw.util
> is not loaded *some of the time*.
>
> The problem manifests itself mostly when you open a tab in the background
> (i.e. you middle-click a link), and especially when I open several tabs in
> the background.
>
> If I turn ResourceLoader off, the error does not occur. So I am thinking it
> has to do with RL. Any ideas on the next steps to investigate this are
> appreciated.
>
> Huji
>
> [1] https://commons.wikimedia.org/wiki/File:Firefox-mw.util-error.png
> [2] https://commons.wikimedia.org/wiki/File:Chrome-mw.util-error.png
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Huji Lee
Okay let me clarify: mw.util *is listed* as a dependency. Otherwise
refreshing the page wouldn't fix it.

On Fri, May 19, 2017 at 11:38 AM, Amir Ladsgroup <[hidden email]>
wrote:

> It's already announced that this won't be loaded by default anymore. You
> need to add it as a dependency.
>
> Best
>
> On Fri, May 19, 2017, 5:54 PM Huji Lee <[hidden email]> wrote:
>
> > Hi
> >
> > This is an issue I am experiencing on Persian Wikipedia (FAWP) for the
> last
> > couple of weeks. I have replicated it in different machines, and after
> > clearing the cache (or using incognito). I have replicated it in Firefox
> > and in Chrome.
> >
> > When you open a page, some times certain widgets (e.g. Twinkle) or
> > user-specific JS scripts don't load. Refreshing the page will fix it 99%
> of
> > the time (that 1% requires refreshing 2 or 3 times).
> >
> > Looking at the console shows an error that indicates "mw.util" is not
> > defined. See the error message in Firefox[1] and Chrome[2] But because
> none
> > of the scripts have changed recently, to me it means somehow that mw.util
> > is not loaded *some of the time*.
> >
> > The problem manifests itself mostly when you open a tab in the background
> > (i.e. you middle-click a link), and especially when I open several tabs
> in
> > the background.
> >
> > If I turn ResourceLoader off, the error does not occur. So I am thinking
> it
> > has to do with RL. Any ideas on the next steps to investigate this are
> > appreciated.
> >
> > Huji
> >
> > [1] https://commons.wikimedia.org/wiki/File:Firefox-mw.util-error.png
> > [2] https://commons.wikimedia.org/wiki/File:Chrome-mw.util-error.png
> > _______________________________________________
> > MediaWiki-l mailing list
> > To unsubscribe, go to:
> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Brion Vibber-4
Does it happen only on the main page perhaps? The MediaWiki:Common.js
<https://fa.wikipedia.org/wiki/MediaWiki:Common.js> on fa.wikipedia
contains this reference to mw.util that is wrapped in an on-dom-ready
instead of a module load wrapper:

/** Main Page layout fixes
********************************************************* * *
Description: Adds an additional link to the complete list of languages
available. *  Maintainers: [[User:AzaToth]], [[User:R. Koot]],
[[User:Alex Smotrov]] */if (['صفحهٔ_اصلی',
'بحث:صفحه_اصلی'].indexOf(mw.config.get('wgPageName')) !== -1) {
  $(function () {
    mw.util.addPortletLink('p-lang',
'//meta.wikimedia.org/wiki/List_of_Wikipedias/fa', 'فهرست کامل',
'interwiki-completelist', 'فهرست کامل');
  });}


-- brion



On Fri, May 19, 2017 at 7:34 PM, Huji Lee <[hidden email]> wrote:

> Okay let me clarify: mw.util *is listed* as a dependency. Otherwise
> refreshing the page wouldn't fix it.
>
> On Fri, May 19, 2017 at 11:38 AM, Amir Ladsgroup <[hidden email]>
> wrote:
>
> > It's already announced that this won't be loaded by default anymore. You
> > need to add it as a dependency.
> >
> > Best
> >
> > On Fri, May 19, 2017, 5:54 PM Huji Lee <[hidden email]> wrote:
> >
> > > Hi
> > >
> > > This is an issue I am experiencing on Persian Wikipedia (FAWP) for the
> > last
> > > couple of weeks. I have replicated it in different machines, and after
> > > clearing the cache (or using incognito). I have replicated it in
> Firefox
> > > and in Chrome.
> > >
> > > When you open a page, some times certain widgets (e.g. Twinkle) or
> > > user-specific JS scripts don't load. Refreshing the page will fix it
> 99%
> > of
> > > the time (that 1% requires refreshing 2 or 3 times).
> > >
> > > Looking at the console shows an error that indicates "mw.util" is not
> > > defined. See the error message in Firefox[1] and Chrome[2] But because
> > none
> > > of the scripts have changed recently, to me it means somehow that
> mw.util
> > > is not loaded *some of the time*.
> > >
> > > The problem manifests itself mostly when you open a tab in the
> background
> > > (i.e. you middle-click a link), and especially when I open several tabs
> > in
> > > the background.
> > >
> > > If I turn ResourceLoader off, the error does not occur. So I am
> thinking
> > it
> > > has to do with RL. Any ideas on the next steps to investigate this are
> > > appreciated.
> > >
> > > Huji
> > >
> > > [1] https://commons.wikimedia.org/wiki/File:Firefox-mw.util-error.png
> > > [2] https://commons.wikimedia.org/wiki/File:Chrome-mw.util-error.png
> > > _______________________________________________
> > > MediaWiki-l mailing list
> > > To unsubscribe, go to:
> > > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> > >
> > _______________________________________________
> > MediaWiki-l mailing list
> > To unsubscribe, go to:
> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Brion Vibber-4
There's also these, which run immediately if the conditions match:

/** * Source codes pages direction and and pre white-space  */if ([2,
4, 8].indexOf(mw.config.get('wgNamespaceNumber')) !== -1) {
        if (/\.(js|css|py)$/.test(mw.config.get('wgPageName'))) {
                mw.util.addCSS('.diff-addedline, .diff-deletedline, .diff-context {
direction: ltr; } ' +
                        '#wpTextbox1 { direction: ltr; }');
        }}
// Newbies are misusing wikilove instead using talk pages add new
section// hiding WikiLove from not autoconfirmed users or without more
than 100 editsif ($.inArray('autoconfirmed',
mw.config.get('wgUserGroups')) === -1 ||
mw.config.get('wgUserEditCount') < 100) {
        mw.util.addCSS('#ca-wikilove { display: none; }');}


There may be more in other code.

-- brion


On Sat, May 20, 2017 at 1:23 AM, Brion Vibber <[hidden email]> wrote:

> Does it happen only on the main page perhaps? The MediaWiki:Common.js
> <https://fa.wikipedia.org/wiki/MediaWiki:Common.js> on fa.wikipedia
> contains this reference to mw.util that is wrapped in an on-dom-ready
> instead of a module load wrapper:
>
> /** Main Page layout fixes ********************************************************* * *  Description: Adds an additional link to the complete list of languages available. *  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]] */if (['صفحهٔ_اصلی', 'بحث:صفحه_اصلی'].indexOf(mw.config.get('wgPageName')) !== -1) {
>   $(function () {
>     mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias/fa', 'فهرست کامل', 'interwiki-completelist', 'فهرست کامل');
>   });}
>
>
> -- brion
>
>
>
> On Fri, May 19, 2017 at 7:34 PM, Huji Lee <[hidden email]> wrote:
>
>> Okay let me clarify: mw.util *is listed* as a dependency. Otherwise
>> refreshing the page wouldn't fix it.
>>
>> On Fri, May 19, 2017 at 11:38 AM, Amir Ladsgroup <[hidden email]>
>> wrote:
>>
>> > It's already announced that this won't be loaded by default anymore. You
>> > need to add it as a dependency.
>> >
>> > Best
>> >
>> > On Fri, May 19, 2017, 5:54 PM Huji Lee <[hidden email]> wrote:
>> >
>> > > Hi
>> > >
>> > > This is an issue I am experiencing on Persian Wikipedia (FAWP) for the
>> > last
>> > > couple of weeks. I have replicated it in different machines, and after
>> > > clearing the cache (or using incognito). I have replicated it in
>> Firefox
>> > > and in Chrome.
>> > >
>> > > When you open a page, some times certain widgets (e.g. Twinkle) or
>> > > user-specific JS scripts don't load. Refreshing the page will fix it
>> 99%
>> > of
>> > > the time (that 1% requires refreshing 2 or 3 times).
>> > >
>> > > Looking at the console shows an error that indicates "mw.util" is not
>> > > defined. See the error message in Firefox[1] and Chrome[2] But because
>> > none
>> > > of the scripts have changed recently, to me it means somehow that
>> mw.util
>> > > is not loaded *some of the time*.
>> > >
>> > > The problem manifests itself mostly when you open a tab in the
>> background
>> > > (i.e. you middle-click a link), and especially when I open several
>> tabs
>> > in
>> > > the background.
>> > >
>> > > If I turn ResourceLoader off, the error does not occur. So I am
>> thinking
>> > it
>> > > has to do with RL. Any ideas on the next steps to investigate this are
>> > > appreciated.
>> > >
>> > > Huji
>> > >
>> > > [1] https://commons.wikimedia.org/wiki/File:Firefox-mw.util-error.png
>> > > [2] https://commons.wikimedia.org/wiki/File:Chrome-mw.util-error.png
>> > > _______________________________________________
>> > > MediaWiki-l mailing list
>> > > To unsubscribe, go to:
>> > > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>> > >
>> > _______________________________________________
>> > MediaWiki-l mailing list
>> > To unsubscribe, go to:
>> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>> >
>> _______________________________________________
>> MediaWiki-l mailing list
>> To unsubscribe, go to:
>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>
>
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Brion Vibber-4
Also check your user JS; this looks like it may be yours and looks like it
would cause this kind of err:

https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1:Huji/vector.js

$(function () {
...

   var y = mw.util.addPortletLink('p-cactions', url+"&section=0",
'ویرایش لید', 'ca-edit-0',
                          'ویرایش بخش آغازین صفحه', 'ویرایش لید',
x.nextSibling);

...

});


-- brion


On Sat, May 20, 2017 at 1:25 AM, Brion Vibber <[hidden email]> wrote:

> There's also these, which run immediately if the conditions match:
>
> /** * Source codes pages direction and and pre white-space  */if ([2, 4, 8].indexOf(mw.config.get('wgNamespaceNumber')) !== -1) {
> if (/\.(js|css|py)$/.test(mw.config.get('wgPageName'))) {
> mw.util.addCSS('.diff-addedline, .diff-deletedline, .diff-context { direction: ltr; } ' +
> '#wpTextbox1 { direction: ltr; }');
> }}
> // Newbies are misusing wikilove instead using talk pages add new section// hiding WikiLove from not autoconfirmed users or without more than 100 editsif ($.inArray('autoconfirmed', mw.config.get('wgUserGroups')) === -1 || mw.config.get('wgUserEditCount') < 100) {
> mw.util.addCSS('#ca-wikilove { display: none; }');}
>
>
> There may be more in other code.
>
> -- brion
>
>
> On Sat, May 20, 2017 at 1:23 AM, Brion Vibber <[hidden email]>
> wrote:
>
>> Does it happen only on the main page perhaps? The MediaWiki:Common.js
>> <https://fa.wikipedia.org/wiki/MediaWiki:Common.js> on fa.wikipedia
>> contains this reference to mw.util that is wrapped in an on-dom-ready
>> instead of a module load wrapper:
>>
>> /** Main Page layout fixes ********************************************************* * *  Description: Adds an additional link to the complete list of languages available. *  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]] */if (['صفحهٔ_اصلی', 'بحث:صفحه_اصلی'].indexOf(mw.config.get('wgPageName')) !== -1) {
>>   $(function () {
>>     mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/List_of_Wikipedias/fa', 'فهرست کامل', 'interwiki-completelist', 'فهرست کامل');
>>   });}
>>
>>
>> -- brion
>>
>>
>>
>> On Fri, May 19, 2017 at 7:34 PM, Huji Lee <[hidden email]> wrote:
>>
>>> Okay let me clarify: mw.util *is listed* as a dependency. Otherwise
>>> refreshing the page wouldn't fix it.
>>>
>>> On Fri, May 19, 2017 at 11:38 AM, Amir Ladsgroup <[hidden email]>
>>> wrote:
>>>
>>> > It's already announced that this won't be loaded by default anymore.
>>> You
>>> > need to add it as a dependency.
>>> >
>>> > Best
>>> >
>>> > On Fri, May 19, 2017, 5:54 PM Huji Lee <[hidden email]> wrote:
>>> >
>>> > > Hi
>>> > >
>>> > > This is an issue I am experiencing on Persian Wikipedia (FAWP) for
>>> the
>>> > last
>>> > > couple of weeks. I have replicated it in different machines, and
>>> after
>>> > > clearing the cache (or using incognito). I have replicated it in
>>> Firefox
>>> > > and in Chrome.
>>> > >
>>> > > When you open a page, some times certain widgets (e.g. Twinkle) or
>>> > > user-specific JS scripts don't load. Refreshing the page will fix it
>>> 99%
>>> > of
>>> > > the time (that 1% requires refreshing 2 or 3 times).
>>> > >
>>> > > Looking at the console shows an error that indicates "mw.util" is not
>>> > > defined. See the error message in Firefox[1] and Chrome[2] But
>>> because
>>> > none
>>> > > of the scripts have changed recently, to me it means somehow that
>>> mw.util
>>> > > is not loaded *some of the time*.
>>> > >
>>> > > The problem manifests itself mostly when you open a tab in the
>>> background
>>> > > (i.e. you middle-click a link), and especially when I open several
>>> tabs
>>> > in
>>> > > the background.
>>> > >
>>> > > If I turn ResourceLoader off, the error does not occur. So I am
>>> thinking
>>> > it
>>> > > has to do with RL. Any ideas on the next steps to investigate this
>>> are
>>> > > appreciated.
>>> > >
>>> > > Huji
>>> > >
>>> > > [1] https://commons.wikimedia.org/wiki/File:Firefox-mw.util-erro
>>> r.png
>>> > > [2] https://commons.wikimedia.org/wiki/File:Chrome-mw.util-error.png
>>> > > _______________________________________________
>>> > > MediaWiki-l mailing list
>>> > > To unsubscribe, go to:
>>> > > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>> > >
>>> > _______________________________________________
>>> > MediaWiki-l mailing list
>>> > To unsubscribe, go to:
>>> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>> >
>>> _______________________________________________
>>> MediaWiki-l mailing list
>>> To unsubscribe, go to:
>>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>>
>>
>>
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Huji Lee
Thanks for taking the time to review these Brion. I will fix every one of
them. I am still curious though: how can it only occur some of the time? A
static script shall always run the same way, no?

On Fri, May 19, 2017 at 7:35 PM, Brion Vibber <[hidden email]> wrote:

> Also check your user JS; this looks like it may be yours and looks like it
> would cause this kind of err:
>
> <a href="https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%A8%D8%">https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%A8%D8%
> B1:Huji/vector.js
>
> $(function () {
> ...
>
>    var y = mw.util.addPortletLink('p-cactions', url+"&section=0",
> 'ویرایش لید', 'ca-edit-0',
>                           'ویرایش بخش آغازین صفحه', 'ویرایش لید',
> x.nextSibling);
>
> ...
>
> });
>
>
> -- brion
>
>
> On Sat, May 20, 2017 at 1:25 AM, Brion Vibber <[hidden email]>
> wrote:
>
> > There's also these, which run immediately if the conditions match:
> >
> > /** * Source codes pages direction and and pre white-space  */if ([2, 4,
> 8].indexOf(mw.config.get('wgNamespaceNumber')) !== -1) {
> >       if (/\.(js|css|py)$/.test(mw.config.get('wgPageName'))) {
> >               mw.util.addCSS('.diff-addedline, .diff-deletedline,
> .diff-context { direction: ltr; } ' +
> >                       '#wpTextbox1 { direction: ltr; }');
> >       }}
> > // Newbies are misusing wikilove instead using talk pages add new
> section// hiding WikiLove from not autoconfirmed users or without more than
> 100 editsif ($.inArray('autoconfirmed', mw.config.get('wgUserGroups')) ===
> -1 || mw.config.get('wgUserEditCount') < 100) {
> >       mw.util.addCSS('#ca-wikilove { display: none; }');}
> >
> >
> > There may be more in other code.
> >
> > -- brion
> >
> >
> > On Sat, May 20, 2017 at 1:23 AM, Brion Vibber <[hidden email]>
> > wrote:
> >
> >> Does it happen only on the main page perhaps? The MediaWiki:Common.js
> >> <https://fa.wikipedia.org/wiki/MediaWiki:Common.js> on fa.wikipedia
> >> contains this reference to mw.util that is wrapped in an on-dom-ready
> >> instead of a module load wrapper:
> >>
> >> /** Main Page layout fixes *********************************************************
> * *  Description: Adds an additional link to the complete list of languages
> available. *  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex
> Smotrov]] */if (['صفحهٔ_اصلی', 'بحث:صفحه_اصلی'].indexOf(mw.config.get('wgPageName'))
> !== -1) {
> >>   $(function () {
> >>     mw.util.addPortletLink('p-lang', '//meta.wikimedia.org/wiki/
> List_of_Wikipedias/fa', 'فهرست کامل', 'interwiki-completelist', 'فهرست
> کامل');
> >>   });}
> >>
> >>
> >> -- brion
> >>
> >>
> >>
> >> On Fri, May 19, 2017 at 7:34 PM, Huji Lee <[hidden email]> wrote:
> >>
> >>> Okay let me clarify: mw.util *is listed* as a dependency. Otherwise
> >>> refreshing the page wouldn't fix it.
> >>>
> >>> On Fri, May 19, 2017 at 11:38 AM, Amir Ladsgroup <[hidden email]>
> >>> wrote:
> >>>
> >>> > It's already announced that this won't be loaded by default anymore.
> >>> You
> >>> > need to add it as a dependency.
> >>> >
> >>> > Best
> >>> >
> >>> > On Fri, May 19, 2017, 5:54 PM Huji Lee <[hidden email]> wrote:
> >>> >
> >>> > > Hi
> >>> > >
> >>> > > This is an issue I am experiencing on Persian Wikipedia (FAWP) for
> >>> the
> >>> > last
> >>> > > couple of weeks. I have replicated it in different machines, and
> >>> after
> >>> > > clearing the cache (or using incognito). I have replicated it in
> >>> Firefox
> >>> > > and in Chrome.
> >>> > >
> >>> > > When you open a page, some times certain widgets (e.g. Twinkle) or
> >>> > > user-specific JS scripts don't load. Refreshing the page will fix
> it
> >>> 99%
> >>> > of
> >>> > > the time (that 1% requires refreshing 2 or 3 times).
> >>> > >
> >>> > > Looking at the console shows an error that indicates "mw.util" is
> not
> >>> > > defined. See the error message in Firefox[1] and Chrome[2] But
> >>> because
> >>> > none
> >>> > > of the scripts have changed recently, to me it means somehow that
> >>> mw.util
> >>> > > is not loaded *some of the time*.
> >>> > >
> >>> > > The problem manifests itself mostly when you open a tab in the
> >>> background
> >>> > > (i.e. you middle-click a link), and especially when I open several
> >>> tabs
> >>> > in
> >>> > > the background.
> >>> > >
> >>> > > If I turn ResourceLoader off, the error does not occur. So I am
> >>> thinking
> >>> > it
> >>> > > has to do with RL. Any ideas on the next steps to investigate this
> >>> are
> >>> > > appreciated.
> >>> > >
> >>> > > Huji
> >>> > >
> >>> > > [1] https://commons.wikimedia.org/wiki/File:Firefox-mw.util-erro
> >>> r.png
> >>> > > [2] https://commons.wikimedia.org/wiki/File:Chrome-mw.util-
> error.png
> >>> > > _______________________________________________
> >>> > > MediaWiki-l mailing list
> >>> > > To unsubscribe, go to:
> >>> > > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >>> > >
> >>> > _______________________________________________
> >>> > MediaWiki-l mailing list
> >>> > To unsubscribe, go to:
> >>> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >>> >
> >>> _______________________________________________
> >>> MediaWiki-l mailing list
> >>> To unsubscribe, go to:
> >>> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >>>
> >>
> >>
> >
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Brion Vibber-4
On Sat, May 20, 2017 at 8:43 PM, Huji Lee <[hidden email]> wrote:

> Thanks for taking the time to review these Brion. I will fix every one of
> them. I am still curious though: how can it only occur some of the time? A
> static script shall always run the same way, no?
>

The scripts are loaded asynchronously, so if there's no dependency declared
there's no guarantee of the ordering that they are executed in.

If you have modules A and B where B uses A in a "$(function(){...})" block,
then you have several possibilities depending on which network request
completes first:

* module A, then module B, then HTML -> works
* module B, then module A, then HTML -> works
* module A, then HTML, then module B -> works
* module B, then HTML, then module A -> fails
* HTML, then module A, then module B -> works
* HTML, then module B, then module A -> fails

Depending on network conditions, size of pages & modules, what's enabled,
and what's cached in your browser, you could land on any of those
possibilities.

-- brion
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Huji Lee
Fair point. What is the ideal way to code on-module-ready in user scripts?

On Sat, May 20, 2017 at 5:34 PM, Brion Vibber <[hidden email]> wrote:

> On Sat, May 20, 2017 at 8:43 PM, Huji Lee <[hidden email]> wrote:
>
> > Thanks for taking the time to review these Brion. I will fix every one of
> > them. I am still curious though: how can it only occur some of the time?
> A
> > static script shall always run the same way, no?
> >
>
> The scripts are loaded asynchronously, so if there's no dependency declared
> there's no guarantee of the ordering that they are executed in.
>
> If you have modules A and B where B uses A in a "$(function(){...})" block,
> then you have several possibilities depending on which network request
> completes first:
>
> * module A, then module B, then HTML -> works
> * module B, then module A, then HTML -> works
> * module A, then HTML, then module B -> works
> * module B, then HTML, then module A -> fails
> * HTML, then module A, then module B -> works
> * HTML, then module B, then module A -> fails
>
> Depending on network conditions, size of pages & modules, what's enabled,
> and what's cached in your browser, you could land on any of those
> possibilities.
>
> -- brion
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mw.util not loading with RL

Brion Vibber-4
On Sun, May 21, 2017 at 4:40 PM, Huji Lee <[hidden email]> wrote:

> Fair point. What is the ideal way to code on-module-ready in user scripts?
>

If you both need to manipulate part of the page and need a specific module,
probably this:

// If we haven't already started loading the module, start loading it:
mw.loader.using('mediawiki.util', function() {
  // Module is loaded, *but* it's possible the page HTML is not done. Wait
for it:
  $( function() {
    // Now it should be safe to do everything:
    mw.util.addPortletLink(....);
  } );
});

I kind of wish we had a per-user version of the Gadgets interface, in which
case you could pre-declare the dependency more easily. :) Something to
think about for later...

-- brion


>
> On Sat, May 20, 2017 at 5:34 PM, Brion Vibber <[hidden email]>
> wrote:
>
> > On Sat, May 20, 2017 at 8:43 PM, Huji Lee <[hidden email]> wrote:
> >
> > > Thanks for taking the time to review these Brion. I will fix every one
> of
> > > them. I am still curious though: how can it only occur some of the
> time?
> > A
> > > static script shall always run the same way, no?
> > >
> >
> > The scripts are loaded asynchronously, so if there's no dependency
> declared
> > there's no guarantee of the ordering that they are executed in.
> >
> > If you have modules A and B where B uses A in a "$(function(){...})"
> block,
> > then you have several possibilities depending on which network request
> > completes first:
> >
> > * module A, then module B, then HTML -> works
> > * module B, then module A, then HTML -> works
> > * module A, then HTML, then module B -> works
> > * module B, then HTML, then module A -> fails
> > * HTML, then module A, then module B -> works
> > * HTML, then module B, then module A -> fails
> >
> > Depending on network conditions, size of pages & modules, what's enabled,
> > and what's cached in your browser, you could land on any of those
> > possibilities.
> >
> > -- brion
> > _______________________________________________
> > MediaWiki-l mailing list
> > To unsubscribe, go to:
> > https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
> >
> _______________________________________________
> MediaWiki-l mailing list
> To unsubscribe, go to:
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
To unsubscribe, go to:
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Loading...