Fix bug with window / this / global context

It looks like you were assigning `this` to context, assuming that it was `window` (es3) and then not referencing the context. When `this` was null (es5 mode) it barfed.