Use window instead of global

We expect global to be window, so we can just use window directly.
Using global caused problems when running tests with jsdom, since
we then create a new window object, but we can't replace global
with that, we can only assign the new window to global.window.