All hooks currently pass in cx: *mut RawJSContext,. In Servo, we have these blocks in a lot of the hooks:
let mut cx = unsafe {
// SAFETY: We are in SM hook
JSContext::from_ptr(NonNull::new(cx).expect("JSContext should not be null in SM hook"))
};
let cx = &mut cx;
Instead of passing the raw jscontext to the hook, it would be nicer to pass in the &mut JSContext to avoid all of these conversions in Servo. That would be a breaking change though, but I think it's manageable.
All hooks currently pass in
cx: *mut RawJSContext,. In Servo, we have these blocks in a lot of the hooks:Instead of passing the raw jscontext to the hook, it would be nicer to pass in the
&mut JSContextto avoid all of these conversions in Servo. That would be a breaking change though, but I think it's manageable.