-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ballot-interpreter): correct JS argument marshaling
If `options` was given as `{ scoreWriteIns: undefined }`, the interpreter would fail to coerce the value as a `bool` but would ignore the error until some point in the future when interacting with the JavaScript context. This is because the `get::<JsBoolean>` call would put the context into a throwing state, but would not then bubble that `Throw` up to the caller. As a result, subsequent calls to the context would also yield `Throw` for operations that should have succeeded. In this case the error would be "failed to downcast any to boolean". To fix this we need to not trigger throws when we don't intend to bubble them up. In particular, instead of `get::<JsBoolean>` we now `get_value()?.downcast::<JsBoolean>` so that we can bubble possible errors from the getter but then handle a mismatched type in Rust appopriately.
- Loading branch information
1 parent
5800d86
commit 72bd015
Showing
3 changed files
with
21 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters