js/ipc/WrapperAnswer.h
author Coroiu Cristina <ccoroiu@mozilla.com>
Fri, 13 Apr 2018 19:49:14 +0300
changeset 469282 bab10eeb6799a277b7237851293041cbec55a370
parent 352652 9adefc25daa8531a4bb7bbca39e39e2f1465024f
child 487438 fe0d98b031aaf0832d1180a3cb03964593169cdd
permissions -rw-r--r--
Backed out 4 changesets (bug 1453480) for failing browser-chrome at browser/components/preferences/in-content/tests/browser_search_subdialogs_within_preferences_site_data.js on a CLOSED TREE Backed out changeset 623b37fe0fe8 (bug 1453480) Backed out changeset a3c36fa7ac0c (bug 1453480) Backed out changeset 46a634d6853c (bug 1453480) Backed out changeset 658fedb903d0 (bug 1453480)

/* -*- 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 dom {
class AutoJSAPI;
} // namespace dom

namespace jsipc {

class WrapperAnswer : public virtual JavaScriptShared
{
  public:
    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* foundp);
    bool RecvHasOwn(const ObjectId& objId, const JSIDVariant& id,
                    ReturnStatus* rs, bool* foundp);
    bool RecvGet(const ObjectId& objId, const JSVariant& receiverVar,
                 const JSIDVariant& id,
                 ReturnStatus* rs, JSVariant* result);
    bool RecvSet(const ObjectId& objId, const JSIDVariant& id, const JSVariant& value,
                 const JSVariant& receiverVar, ReturnStatus* rs);

    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 RecvGetBuiltinClass(const ObjectId& objId, ReturnStatus* rs,
                             uint32_t* classValue);
    bool RecvIsArray(const ObjectId& objId, ReturnStatus* rs, uint32_t* ans);
    bool RecvClassName(const ObjectId& objId, nsCString* result);
    bool RecvGetPrototype(const ObjectId& objId, ReturnStatus* rs, ObjectOrNullVariant* result);
    bool RecvGetPrototypeIfOrdinary(const ObjectId& objId, ReturnStatus* rs, bool* isOrdinary,
                                    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(dom::AutoJSAPI& jsapi, ReturnStatus* rs);
    bool ok(ReturnStatus* rs);
    bool ok(ReturnStatus* rs, const JS::ObjectOpResult& result);
    bool deadCPOW(dom::AutoJSAPI& jsapi, ReturnStatus* rs);
};

} // namespace jsipc
} // namespace mozilla

#endif