Skip to content

Pass &mut JSContext to hooks #772

Description

@TimvdLippe

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions