Ejemplo n.º 1
0
MapObject*
MapObject::create(JSContext* cx)
{
    Rooted<MapObject*> obj(cx, NewBuiltinClassInstance<MapObject>(cx));
    if (!obj)
        return nullptr;

    ValueMap* map = cx->new_<ValueMap>(cx->runtime());
    if (!map || !map->init()) {
        js_delete(map);
        ReportOutOfMemory(cx);
        return nullptr;
    }

    obj->setPrivate(map);
    return obj;
}