isolated-vm
isolated-vm copied to clipboard
Conversion throws when trying to transfer out with unclear message/no stack-trace
Hi
I have a code snippet which is calling the javascript bind function, using the compileScript and then runIgnored functions, something like the following:
a.method.bind(a)
which is throwing an error:
libc++abi: terminating with uncaught exception of type ivm::ParamIncorrect: std::exception
but no stack trace
I debugged the isolated-vm code and found a few things:
- The error is being thrown when creating a
CallbackTransferable
because theGetDebugName
returns null/undefined rather than a string here https://github.com/laverdet/isolated-vm/blob/27cb89d3c3c4ef433af22ac8efa38a26f1caabda/src/module/transferable.cc#L245 - The interface says:
Runs a given script within a context. This will return the last value evaluated in a given script, as long as that value was transferable, otherwise undefined will be returned.
, should there be some check here if it throws during the conversion phase? - Should there be an explicit "None" transferable option we can pass so that we ignore the execution result?