| 72 | } |
| 73 | |
| 74 | GJS_JSAPI_RETURN_CONVENTION |
| 75 | static bool append_new_cause(JSContext* cx, JS::HandleValue thrown, |
| 76 | JS::HandleValue new_cause, bool* appended) { |
| 77 | g_assert(appended && "forgot out parameter"); |
| 78 | *appended = false; |
| 79 | |
| 80 | JS::Rooted<CauseSet> seen_causes(cx); |
| 81 | JS::RootedObject last_cause{cx}; |
| 82 | if (!get_last_cause(cx, thrown, &last_cause, &seen_causes)) |
| 83 | return false; |
| 84 | if (!last_cause) |
| 85 | return true; |
| 86 | |
| 87 | const GjsAtoms& atoms = GjsContextPrivate::atoms(cx); |
| 88 | if (!JS_SetPropertyById(cx, last_cause, atoms.cause(), new_cause)) |
| 89 | return false; |
| 90 | |
| 91 | *appended = true; |
| 92 | return true; |
| 93 | } |
| 94 | |
| 95 | [[gnu::format(printf, 4, 0)]] |
| 96 | static void gjs_throw_valist(JSContext* cx, JSExnType error_kind, |
no test coverage detected