I have small test
import STPyV8
test = '''
(async() => {
window = {}
window.opener = null
window.opener.location
})()
'''
with STPyV8.JSContext() as ctx:
ctx.eval(test) # no output
without async it has expected output TypeError: Cannot read properties of null (reading 'location')