[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-28 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #21 from Bartosz DziewoƄski --- I quite like the document.write one, seems it will have the least impact on users with non-broken user JS and should be easy to implement? -- You are receiving this mail because: You are the assigne

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-27 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #20 from Krinkle --- (In reply to Krinkle from comment #19) > Another solution would be to return early instead of wrap the whole thing. > > While a return statement is not allowed in the global scope, a throw works > fine. > > >

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-27 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #19 from Krinkle --- Another solution would be to return early instead of wrap the whole thing. While a return statement is not allowed in the global scope, a throw works fine. if (!cond) throw ''; .. rest of script .. .. mw

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-27 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #18 from Krinkle --- Another solution would be to return early instead of wrap the whole thing. While a return statement is not allowed in the global scope, a throw works fine. if (!cond) throw ''; .. rest of script .. .. mw

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-27 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #17 from Krinkle --- Alternatively, we might be able to do the condition outside the script. Perhaps something like replace this: with: if (cond) document.write("\u003Cscript src=\"./load.php?modules=user\u0026only=scripts\u0026

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-27 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #16 from Michael M. --- What about only wrapping the mw.loader.state({"user":"ready"}); at the bottom in an if-clause (or prefixing it with window.mw && ) and leaving the rest of the script alone? I hadn't seen that call to mw.load

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #15 from Krinkle --- Open to other ideas. Of neither #1 or #2 is acceptable, we may have to remove the if-wrap for the time being since modern Firefox triumps priority over grade C browsers. -- You are receiving this mail because:

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #14 from Krinkle --- Hm.. so yeah, that's annoying. The condition-wrap is supposed to hide an issue in old browsers, not introduce issues in modern browsers. So far I've only seen two possible solutions: 1) Wrap in $.globalEval, p

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #13 from Krinkle --- > quux(); if (true) { function quux() { return 1; } } else { function quux() { > return 2; } } V8> 2 SpiderMonkey> quux is undefined -- You are receiving this mail because: You are the assignee for the bug. Y

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #12 from Krinkle --- > > function bar() { return 1; } > > bar(); > >> 1 > > > if (true) { > > function bar() { return 1; } > > } else { > > function bar() { return 2; } > > } > > bar(); > >> 2 btw, in Firefox this yields 1. -

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #11 from Krinkle --- This is not a new problem. Users using older browsers have always had fatal errors because jquery/mediawiki are not loaded in blacklisted browsers not supporting our required version for the javascript engine. T

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #10 from Michael M. --- As actually nobody explicitly quoted the relevant standards yet: * ECMAScript defines FunctionDecleration and FunctionExpression. (http://ecma-international.org/ecma-262/5.1/#sec-13) * Firefox (and other bro

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #9 from Michael M. --- (In reply to Erik Moeller from comment #7) > Michael, if common.js is non-blank, this will lead to site-wide errors in > IE6 (and other disabled browsers). My comment was limited to user scripts, and did not

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #8 from Andre Klapper --- Another example: https://de.wikipedia.org/w/index.php?title=Wikipedia:Technik/Werkstatt&oldid=133432119#.C3.84nderung_im_Javascript.3F -- You are receiving this mail because: You are the assignee for the

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-26 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #7 from Erik Moeller --- Michael, if common.js is non-blank, this will lead to site-wide errors in IE6 (and other disabled browsers). That was one of the motivations for Timo's change. But I'll let him comment on strategies to resol

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-25 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #6 from Michael M. --- Why do user scripts have to be enveloped in that if-clause anyway? 1. In most browsers the global mw will be defined before the user script is executed, so there is no need to test for it. 2. If for some reas

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-23 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 --- Comment #5 from Fomafix --- $.globalEval() [1] as suggested in bug 63587 would be a possible solution. Maybe this can added as a general optional parameter for all modules. [1] https://api.jquery.com/jQuery.globalEval/ -- You are receiv

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-23 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 Andre Klapper changed: What|Removed |Added Priority|Unprioritized |High -- You are receiving this mail b

[Bug 69924] Wrapping user scripts with "if(window.mw){...}" breaks them on Firefox

2014-08-23 Thread bugzilla-daemon
https://bugzilla.wikimedia.org/show_bug.cgi?id=69924 Helder changed: What|Removed |Added See Also||https://bugzilla.wikimedia.