| 181 | } |
| 182 | |
| 183 | void gjs_throw_abstract_constructor_error(JSContext* cx, |
| 184 | const JS::CallArgs& args) { |
| 185 | const char* name = "anonymous"; |
| 186 | |
| 187 | const GjsAtoms& atoms = GjsContextPrivate::atoms(cx); |
| 188 | JS::RootedObject callee{cx, &args.callee()}; |
| 189 | JS::RootedValue prototype{cx}; |
| 190 | if (JS_GetPropertyById(cx, callee, atoms.prototype(), &prototype)) { |
| 191 | const JSClass* proto_class = JS::GetClass(&prototype.toObject()); |
| 192 | name = proto_class->name; |
| 193 | } |
| 194 | |
| 195 | gjs_throw(cx, "You cannot construct new instances of '%s'", name); |
| 196 | } |
| 197 | |
| 198 | JSObject* gjs_build_string_array(JSContext* cx, |
| 199 | const std::vector<std::string>& strings) { |
no test coverage detected