js/ipc/WrapperAnswer.h
author Kyle Huey <khuey@kylehuey.com>
Fri, 16 Jan 2015 11:58:52 -0800
changeset 251432 f498989ed56f3d5b4fae5e2bd1a0ca0c0f99014e
parent 238590 054f17d341c1cc190480ef74438a3863f4d82d57
child 255571 6586155409370dc02f68c3499a5c535200319979
permissions -rw-r--r--
Bug 1121673: Use move references in IPDL. r=bent

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * vim: set ts=4 sw=4 et tw=80:
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef mozilla_jsipc_WrapperAnswer_h_
#define mozilla_jsipc_WrapperAnswer_h_

#include "JavaScriptShared.h"

namespace mozilla {
namespace jsipc {

class WrapperAnswer : public virtual JavaScriptShared
{
  public:
    explicit WrapperAnswer(JSRuntime *rt) : JavaScriptShared(rt) {}

    bool RecvPreventExtensions(const ObjectId &objId, ReturnStatus *rs,
                               bool *succeeded);
    bool RecvGetPropertyDescriptor(const ObjectId &objId, const JSIDVariant &id,
                                   ReturnStatus *rs,
                                   PPropertyDescriptor *out);
    bool RecvGetOwnPropertyDescriptor(const ObjectId &objId,
                                      const JSIDVariant &id,
                                      ReturnStatus *rs,
                                      PPropertyDescriptor *out);
    bool RecvDefineProperty(const ObjectId &objId, const JSIDVariant &id,
                            const PPropertyDescriptor &flags,
                            ReturnStatus *rs);
    bool RecvDelete(const ObjectId &objId, const JSIDVariant &id,
                    ReturnStatus *rs, bool *success);

    bool RecvHas(const ObjectId &objId, const JSIDVariant &id,
                 ReturnStatus *rs, bool *bp);
    bool RecvHasOwn(const ObjectId &objId, const JSIDVariant &id,
                    ReturnStatus *rs, bool *bp);
    bool RecvGet(const ObjectId &objId, const ObjectVariant &receiverVar,
                 const JSIDVariant &id,
                 ReturnStatus *rs, JSVariant *result);
    bool RecvSet(const ObjectId &objId, const ObjectVariant &receiverVar,
                 const JSIDVariant &id, const bool &strict,
                 const JSVariant &value, ReturnStatus *rs, JSVariant *result);

    bool RecvIsExtensible(const ObjectId &objId, ReturnStatus *rs,
                          bool *result);
    bool RecvCallOrConstruct(const ObjectId &objId, InfallibleTArray<JSParam> &&argv,
                             const bool &construct, ReturnStatus *rs, JSVariant *result,
                             nsTArray<JSParam> *outparams);
    bool RecvHasInstance(const ObjectId &objId, const JSVariant &v, ReturnStatus *rs, bool *bp);
    bool RecvObjectClassIs(const ObjectId &objId, const uint32_t &classValue,
                           bool *result);
    bool RecvClassName(const ObjectId &objId, nsString *result);
    bool RecvRegExpToShared(const ObjectId &objId, ReturnStatus *rs, nsString *source, uint32_t *flags);

    bool RecvGetPropertyKeys(const ObjectId &objId, const uint32_t &flags,
                             ReturnStatus *rs, nsTArray<JSIDVariant> *ids);
    bool RecvInstanceOf(const ObjectId &objId, const JSIID &iid,
                        ReturnStatus *rs, bool *instanceof);
    bool RecvDOMInstanceOf(const ObjectId &objId, const int &prototypeID, const int &depth,
                           ReturnStatus *rs, bool *instanceof);

    bool RecvDropObject(const ObjectId &objId);

  private:
    bool fail(JSContext *cx, ReturnStatus *rs);
    bool ok(ReturnStatus *rs);
};

} // mozilla
} // jsipc

#endif