https://bugzilla.wikimedia.org/show_bug.cgi?id=47296

       Web browser: ---
            Bug ID: 47296
           Summary: mw.loader.using throws exception when a module doesn't
                    exist [mobile]
           Product: MediaWiki
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: ResourceLoader
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: jrob...@wikimedia.org
                CC: krinklem...@gmail.com, roan.katt...@gmail.com,
                    tpars...@wikimedia.org
    Classification: Unclassified
   Mobile Platform: ---

To give an example:
mediawiki.page.ready.js runs on mobile (it specifies targets=>mobile) however
attempts to lazy load the tablesorter plugin which is not available on mobile
(it specifies targets=>desktop)

This currently throws an exception.

Avoiding a bike shedding conversation about whether jquery.tablesorter should
be available on mobile, it is wrong to make the assumption that a module will
always be available.

Expected: Instead of seeing an exception I would like to allow the user to
handle the error themselves - allowing optional modules to die silently.

e.g.
mw.loader.using( 'jquery.tablesorter', function () {
    $sortableTables.tablesorter();
}, function( e ) {
throw e;
});

or 
mw.loader.using( 'jquery.tablesorter' ).done( function () {
    $sortableTables.tablesorter();
});

Another example of this being a problem is on the edit page which asumes
mediawiki.action.edit is available:

mw.loader.using("mediawiki.action.edit"

Currently there is a hack in MobileFrontend to get around this [1]


[1]
https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/MobileFrontend.git;a=blob;f=includes/skins/SkinMobile.php;h=27ab4ef44fc138566bbf3e1ab32cd5af20daf246;hb=HEAD#l241

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to