Get window object from XMLHttpRequest.window if set
Merge branch 'cookie'