Check for redefine of coverage var and passing window as a function parameter

A continuation of #255