Use window if 'this' is not defined

Signed-off-by: Ryan Chen <ryan.chen@turn.com>