| 145 | } |
| 146 | |
| 147 | GJS_JSAPI_RETURN_CONVENTION |
| 148 | static JSObject* define_native_accessor_wrapper(JSContext* cx, JSNative call, |
| 149 | unsigned nargs, |
| 150 | const char* func_name, |
| 151 | JS::HandleValue private_slot) { |
| 152 | JSFunction* func = |
| 153 | js::NewFunctionWithReserved(cx, call, nargs, 0, func_name); |
| 154 | if (!func) |
| 155 | return nullptr; |
| 156 | |
| 157 | JSObject* func_obj = JS_GetFunctionObject(func); |
| 158 | js::SetFunctionNativeReserved(func_obj, DYNAMIC_PROPERTY_PRIVATE_SLOT, |
| 159 | private_slot); |
| 160 | return func_obj; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * gjs_define_property_dynamic: |
no outgoing calls
no test coverage detected