const p = new Interpreter('')
function Aa(handler) {
this.handler = handler
}
function AdWrapper () {
return Aa
}
var str = 'console.log(111, new (AdWrapper())(function() {}))' // Throw Error: Cannot set property 'handler' of undefined
p.setProperty.(p.globalObject, 'AdWrapper', p.createHostProxy(AdWrapper, true))
p.appendCode(str)
p.keepRun()
Well, If I run the code in the normal js environment, it ok:
function Aa(handler) {
this.handler = handler
}
function AdWrapper () {
return Aa
}
console.log(111, new (AdWrapper())(function() {})) // it's ok
The example code is:
Well, If I run the code in the normal js environment, it ok: