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

            Bug ID: 69924
           Summary: Gerrit 152122 breaks scripts on Firefox
           Product: MediaWiki
           Version: 1.24-git
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: Unprioritized
         Component: ResourceLoader
          Assignee: wikibugs-l@lists.wikimedia.org
          Reporter: foma...@googlemail.com
                CC: entli...@gmx-topmail.de, krinklem...@gmail.com,
                    roan.katt...@gmail.com, tpars...@wikimedia.org,
                    umherirrender_de...@web.de, wikipe...@deeprocks.de
       Web browser: Firefox
   Mobile Platform: ---

https://gerrit.wikimedia.org/r/152122 adds an additional

 if(window.mw){...}

around of user scripts. This breaks some scripts in Firefox. Some scripts use
forward references of functions like

 foo();
 function foo() {
   console.log( 'foo' );
 }

Forward references normally work, but not in an if block.

 if ( true ) {
   foo();
   function foo() {
     console.log( 'foo' );
   }
 }

generates

 ReferenceError: foo is not defined


A possible workaround is to put this in an additional closure because

 if ( true ) {
   ( function () {
     foo();
     function foo() {
       console.log( 'foo' );
     }
   }() );
 }

works also in Firefox.

Instead of

 if(window.mw){...}

the script has to wrapped with 

 if(window.mw){(function(){...}());}

-- 
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