Closed Fiveside closed 7 years ago
In general, the first step when investigating odd behaviour with rust-mozjs is to enable the debugmozjs cargo feature and use a non-release build. I suspect the error you will see will complain that you are not in a compartment; you can avoid this by adding something like let _ac = AutoCompartment::new(cx, global.get());
.
Aha! I had misunderstood the difference between compartments and rooted values. Re-reading the documentation cleared that up for me. Yes, switching compartments did fix the problem. Unfortunately, enabling debugmozjs
and running without the compartment still caused a segmentation fault. Once I cleared that up however, I have much more descriptive debugging messages.
Thanks for your help!
I'm playing around with the mozjs rust bindings, but I'm getting a segmentation fault when I run a script that throws an exception when it runs.
The equivalent C++ seems to run fine, but this just crashes. What is the correct way to inspect an error that occurred during initial script execution?