isolated-vm icon indicating copy to clipboard operation
isolated-vm copied to clipboard

Conversion throws when trying to transfer out with unclear message/no stack-trace

Open pashakondratyev opened this issue 2 years ago • 0 comments

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:

  1. The error is being thrown when creating a CallbackTransferable because the GetDebugName returns null/undefined rather than a string here https://github.com/laverdet/isolated-vm/blob/27cb89d3c3c4ef433af22ac8efa38a26f1caabda/src/module/transferable.cc#L245
  2. 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?
  3. Should there be an explicit "None" transferable option we can pass so that we ignore the execution result?

pashakondratyev avatar Feb 04 '22 19:02 pashakondratyev