This is needed for shadow realms which don't have a window or worker global object. Fixes a crash for the attached test.