Function mozjs::jsapi::js::GetPropertyKeys

source ยท
pub unsafe extern "C" fn GetPropertyKeys(
    cx: *mut JSContext,
    obj: Handle<*mut JSObject>,
    flags: u32,
    props: MutableHandleIdVector,
) -> bool
Expand description

Add some or all property keys of obj to the id vector *props.

The flags parameter controls which property keys are added. Pass a combination of the following bits:

JSITER_OWNONLY - Don't also search the prototype chain; only consider
  obj's own properties.

JSITER_HIDDEN - Include nonenumerable properties.

JSITER_SYMBOLS - Include property keys that are symbols. The default
  behavior is to filter out symbols.

JSITER_SYMBOLSONLY - Exclude non-symbol property keys.

This is the closest C++ API we have to Reflect.ownKeys(obj), or equivalently, the ES6 [[OwnPropertyKeys]] internal method. Pass JSITER_OWNONLY | JSITER_HIDDEN | JSITER_SYMBOLS as flags to get results that match the output of Reflect.ownKeys.