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(){...}());}
Version: 1.24rc
Severity: major