[core] Fix value of `this` inside ES6 module definitions

Fixes #1596.

The value of `this` inside YUI modules is a `mod` object. ES6 modules need to point to the global object in sloppy mode and to `undefined` in strict mode.

Ping @caridy