Core: add location global for non-browsers, fix #1788

This is a simple fix that will also prevent future problems with this.
Of course, it would be nice to add a test, but I think it's a bit beyond the scope at the moment.
Poke #1788.
A variable will get moved to module if another module needs it. We have a custom build system that compiles modules containing a single return statement into var statements.

```js
// File foo.js
define(function() {
  return 'awesome';
});
```

becomes...

```js
var foo = 'awesome';
```

This allows multiple modules to share the same variable without affecting the built file size. It also limits the scope of variables to the modules that use them, bypassing the need for unused workarounds.