If a user uses something like
> window.windowDotSomething = true;
> justSomething = true;
to declare a few variables they will be global variables, and if the user uses
> var varSomething = true;
in a ResourceLoader-enabled gadget or in their new global.js provided by the GlobalCssJs extension, this will create a local variable (they are inside of a mw.loader.implement wrapper). This is the expected behavior.
However
> var varSomething = true;
results in a *global* variable if inserted in user subpages like [[Special:MyPage/common.js]] or [[MediaWiki:Common.js]]:
> window.varSomething
true
Using "var" should not create a global variable in any case, and users should not rely in the current behavior when writing their scripts, because this usually causes bugs when porting user scripts to gadgets, due to the need to replace lots of "var example"s with explicitly declared globals like "window.example".
TLDR: drop support for executing page.js scripts in the global scope.
--------------------------
**Version**: 1.23.0
**Severity**: enhancement
**See Also**:
https://bugzilla.wikimedia.org/show_bug.cgi?id=62605
https://bugzilla.wikimedia.org/show_bug.cgi?id=63587