Function script::dom::bindings::conversions::root_from_object

source ยท
pub fn root_from_object<T>(
    obj: *mut JSObject,
    cx: *mut JSContext,
) -> Result<Root<Dom<T>>, ()>
Expand description

Get a DomRoot<T> 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 a reflector for a DOM object of the given type (as defined by the proto_id and proto_depth).