| 128 | } |
| 129 | |
| 130 | JSObject* gjs_construct_object_dynamic(JSContext* cx, JS::HandleObject proto, |
| 131 | const JS::HandleValueArray& args) { |
| 132 | const GjsAtoms& atoms = GjsContextPrivate::atoms(cx); |
| 133 | JS::RootedObject constructor{cx}; |
| 134 | |
| 135 | if (!gjs_object_require_property(cx, proto, "prototype", |
| 136 | atoms.constructor(), &constructor)) |
| 137 | return nullptr; |
| 138 | |
| 139 | JS::RootedValue v_constructor{cx, JS::ObjectValue(*constructor)}; |
| 140 | JS::RootedObject object{cx}; |
| 141 | if (!JS::Construct(cx, v_constructor, args, &object)) |
| 142 | return nullptr; |
| 143 | |
| 144 | return object; |
| 145 | } |
| 146 | |
| 147 | GJS_JSAPI_RETURN_CONVENTION |
| 148 | static JSObject* define_native_accessor_wrapper(JSContext* cx, JSNative call, |
no test coverage detected