Closed zofrex closed 9 years ago
A JS_Init
call is necessary first.
I'm annoyed at myself for wasting my time, and your time... I'm not sure at what point the JS_Init got lost out of my code (from which I prepared this sample) but of course it's necessary first.
Sorry!
Edit: Also, thanks for the super fast reply!
Note to anyone else passing: Runtime::new() used to include a JS_Init call, now it no longer does. This works:
unsafe {
JS_Init();
}
let r = Runtime::new();
JS_Init is new with the SM upgrade we had recently - the tests in this code don't use them either.
I recommend building with --features js/debugmozjs
while developing which will enable assertions in SM. Many jsapi issues can be caught with that. The rest are usually caught by running with JS_GC_ZEAL=4,1
.
Thanks Michael, that's very helpful to know!
Test case:
Result: Crashes
This is where it crashes on my machine (OS X)
vers on IRC volunteered to try it too and got this slightly different crash on Fedora 22 (valgrind output)