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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected]
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
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l