webdriver icon indicating copy to clipboard operation
webdriver copied to clipboard

`internal JSON clone algorithm` has to raise "javascript error" if object's `toJSON()` method throws

Open whimboo opened this issue 2 years ago • 1 comments

https://github.com/w3c/webdriver/issues/849 implemented the feature to call toJSON() for internal JSON clone algorithm if it exists on an object. But as seen while working on https://github.com/w3c/webdriver/pull/1709 it misses to catch errors potentially thrown by executing this method.

In such a situation the error as raised should be caught and re-thrown as javascript error.

whimboo avatar Jan 06 '23 13:01 whimboo

The fundamental issue is that in order to actually do that we need to set up an execution environment and handle the fact that the return type is an ES completion record (i.e. the equivalent of a Result<T, E>). There's a few places where we just casually try to perform operations that could execute script without being specific about where we do it, or how errors are handled.

jgraham avatar Jan 06 '23 14:01 jgraham