I think a better fix is to change the Browser.requestAnimationFrame function to work even when window is not present. Basically to push this check into that function (so other callers benefit as well).