bool MutatePrototype(JSContext* cx, HandlePlainObject obj, HandleValue value) { if (!value.isObjectOrNull()) return true; RootedObject newProto(cx, value.toObjectOrNull()); return SetPrototype(cx, obj, newProto); }
bool MutatePrototype(JSContext *cx, HandlePlainObject obj, HandleValue value) { if (!value.isObjectOrNull()) return true; RootedObject newProto(cx, value.toObjectOrNull()); bool succeeded; if (!JSObject::setProto(cx, obj, newProto, &succeeded)) return false; MOZ_ASSERT(succeeded); return true; }
bool MutatePrototype(JSContext *cx, HandleObject obj, HandleValue value) { MOZ_ASSERT(obj->is<JSObject>(), "must only be used with object literals"); if (!value.isObjectOrNull()) return true; RootedObject newProto(cx, value.toObjectOrNull()); bool succeeded; if (!JSObject::setProto(cx, obj, newProto, &succeeded)) return false; MOZ_ASSERT(succeeded); return true; }