script::dom::bindings::conversions

Function private_from_proto_check

Source
pub(crate) unsafe fn private_from_proto_check(
    obj: *mut JSObject,
    cx: *mut JSContext,
    proto_check: PrototypeCheck,
) -> Result<*const c_void, ()>
Expand description

Get a *const libc::c_void for the given DOM object, unwrapping any wrapper around it first, and checking if the object is of the correct type.

Returns Err(()) if obj is an opaque security wrapper or if the object is not an object for a DOM object of the given type (as defined by the proto_id and proto_depth).

§Safety

obj must point to a valid, non-null JS object. cx must point to a valid, non-null JS context.