Refactor DOMWindow

Continuation of #920, but on tmpvar/ instead of Sebmaster/ so everyone can join in the fun.