script_bindings::conversions

Function root_from_handlevalue

Source
pub unsafe fn root_from_handlevalue<T>(
    v: HandleValue<'_>,
    cx: *mut JSContext,
) -> Result<DomRoot<T>, ()>
Expand description

Get a DomRoot<T> for a DOM object accessible from a HandleValue. Caller is responsible for throwing a JS exception if needed in case of error.

§Safety

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