| 263 | JS_FS_END}; |
| 264 | |
| 265 | static bool get_program_args(JSContext* cx, unsigned argc, JS::Value* vp) { |
| 266 | static const size_t SLOT_ARGV = 0; |
| 267 | |
| 268 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| 269 | GjsContextPrivate* priv = GjsContextPrivate::from_cx(cx); |
| 270 | |
| 271 | JS::RootedValue v_argv( |
| 272 | cx, js::GetFunctionNativeReserved(&args.callee(), SLOT_ARGV)); |
| 273 | |
| 274 | if (v_argv.isUndefined()) { |
| 275 | // First time this property is accessed, build the array |
| 276 | JS::RootedObject argv(cx, priv->build_args_array()); |
| 277 | if (!argv) |
| 278 | return false; |
| 279 | js::SetFunctionNativeReserved(&args.callee(), SLOT_ARGV, |
| 280 | JS::ObjectValue(*argv)); |
| 281 | args.rval().setObject(*argv); |
| 282 | } else { |
| 283 | args.rval().set(v_argv); |
| 284 | } |
| 285 | |
| 286 | return true; |
| 287 | } |
| 288 | |
| 289 | bool gjs_js_define_system_stuff(JSContext* cx, JS::MutableHandleObject module) { |
| 290 | module.set(JS_NewPlainObject(cx)); |
nothing calls this directly
no test coverage detected