#![allow(
non_upper_case_globals,
non_camel_case_types,
non_snake_case,
improper_ctypes
)]
use ::std::ptr;
use mozjs::rooted;
use mozjs::rust::wrappers2::JS_NewGlobalObject;
use mozjs::rust::SIMPLE_GLOBAL_CLASS;
use mozjs::{jsapi::*, rust::JSEngine, rust::RealmOptions, rust::Runtime};
fn main() {
let engine = JSEngine::init().expect("failed to initalize JS engine");
let runtime = Runtime::new(engine.handle());
run(runtime);
}
fn run(mut rt: Runtime) {
let cx = rt.cx();
let options = RealmOptions::default();
rooted!(&in(cx) let _global = unsafe {
JS_NewGlobalObject(cx, &SIMPLE_GLOBAL_CLASS, ptr::null_mut(),
OnNewGlobalHookOption::FireOnNewGlobalHook,
&*options)
});
}
#[test]
fn minimal_example() {
main()
}