wraps all references to window so that this can be used in firefox background scripts;