js/ipc/WrapperAnswer.h
author Phil Ringnalda <philringnalda@gmail.com>
Sun, 22 Mar 2015 09:34:25 -0700
changeset 234964 c3638d994edd641c54b6cfcc60d8f32576530eca
parent 234963 7613fc978d36faaf405f3490c19c85886c9e9686
child 236134 8c02abfe5360fa4bf00c5c59ea1640f1e2e7c14a
permissions -rw-r--r--
Backed out 9 changesets (bug 1142775, bug 1139683, bug 1143810, bug 1142761, bug 1142784, bug 1142794, bug 1144819) for widespread bustage CLOSED TREE Backed out changeset 7613fc978d36 (bug 1142794) Backed out changeset e5f0cb31263d (bug 1142784) Backed out changeset dcd0af73ac84 (bug 1142784) Backed out changeset 034f9c8e79ee (bug 1142784) Backed out changeset ce0ee37e3ca9 (bug 1142775) Backed out changeset 1519b8f2bbba (bug 1142761) Backed out changeset 26fd55677841 (bug 1139683) Backed out changeset 7ebc76a450c3 (bug 1144819) Backed out changeset 92adb459d519 (bug 1143810)

/* -*- 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 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 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 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 RecvGetPrototype(const ObjectId &objId, ReturnStatus *rs, ObjectOrNullVariant *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);
    bool ok(ReturnStatus *rs, const JS::ObjectOpResult &result);
};

} // mozilla
} // jsipc

#endif