Files
palemoon27/js/ipc/JavaScriptBase.h
T
roytam1 017cbb1f8d import changes from `dev' branch of rmottola/Arctic-Fox:
- more pointer style... take away, put again... (640edf447)
- Bug 1139683 - Rewrite SetExistingProperty with comments and references to the standard. r=efaust. (0da1e634b)
- Bug 1142775 - Rename NativeSet -> NativeSetExistingDataProperty and simplify it since it is only called for data properties. Delete Shape::set. Add comments. No change in behavior. r=efaust. (1fec7be0a)
- Bug 1142794 - Change 'receiver' argument to SetProperty functions and ProxyHandler::set methods to be a HandleValue. r=Waldo. (032f78c22)
- Bug 1149377 - Disable PGO on ICCallStubCompiler::guardFunApply. r=jandem (aa0617c41)
- Revert Bug 1137180 - Allow unboxed objects to be extended with new properties, r=jandem. (1970f92f0)
- Bug 1137180 - Add most functionality necessary for extensible unboxed objects, r=jandem. (30768aa93)
- Bug 1137180 - Add baseline caches for extensible unboxed objects, and enable extensible unboxed objects (still off by default), r=jandem. (8c6aa02f9)
- Bug 1143011 - Extract the has/add/take logic out of the register sets to distinguish between allocatable and live sets. r=jandem,Waldo (430b0830f)
- Bug 1143011 - Use AllocatableSet or LiveSet for all register set uses. r=jandem (69dc22ad9)
- Bug 1150384 - IonMonkey: MIPS: Fix build failure caused by Bug 1143011. r=rankov (f532d5095)
- Bug 1145811 - Remove simdSet argument of PushRegsInMask. r=bbouvier (7c1dd4847)
- Bug 1148880 - Make Trampoline-arm.cpp compile with Clang again. r=nbp (b89564285)
- Bump the XDR version two more to account for yet more branch-versioning oddities. No bug, r=me as trivial, DONTBUILD because really building bytecode-bumping patchwork twice is just too much for an opaque identifier that we already built once, pushing in a CLOSED TREE because version bumps are risk-free and these versions are needed for a branch backport and otherwise I'm spinning wheels waiting on the tree to reopen right now (ab7ac9762)
- partial of Bug 1144366 - Switch SpiderMonkey and XPConnect style from |T *t| to |T* t|. r=jorendorff (9e27b1ba4)
- Bug 1134626 part 1 - Move all x86-shared files into their own directory. r=jandem (6267cdb05)
- Bug 1134626 part 2 - Move x86 & x64 Architecture into a shared file. r=jandem (467731dfc)
2020-05-30 12:48:59 +08:00

223 lines
10 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 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_JavaScriptBase_h__
#define mozilla_jsipc_JavaScriptBase_h__
#include "WrapperAnswer.h"
#include "WrapperOwner.h"
#include "mozilla/dom/DOMTypes.h"
#include "mozilla/jsipc/PJavaScript.h"
namespace mozilla {
namespace jsipc {
template<class Base>
class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base
{
typedef WrapperAnswer Answer;
public:
explicit JavaScriptBase(JSRuntime* rt)
: JavaScriptShared(rt),
WrapperOwner(rt),
WrapperAnswer(rt)
{}
virtual ~JavaScriptBase() {}
virtual void ActorDestroy(WrapperOwner::ActorDestroyReason why) {
WrapperOwner::ActorDestroy(why);
}
/*** IPC handlers ***/
bool RecvPreventExtensions(const uint64_t &objId, ReturnStatus *rs) {
return Answer::RecvPreventExtensions(ObjectId::deserialize(objId), rs);
}
bool RecvGetPropertyDescriptor(const uint64_t &objId, const JSIDVariant &id,
ReturnStatus *rs,
PPropertyDescriptor *out) {
return Answer::RecvGetPropertyDescriptor(ObjectId::deserialize(objId), id, rs, out);
}
bool RecvGetOwnPropertyDescriptor(const uint64_t& objId,
const JSIDVariant& id,
ReturnStatus* rs,
PPropertyDescriptor* out) {
return Answer::RecvGetOwnPropertyDescriptor(ObjectId::deserialize(objId), id, rs, out);
}
bool RecvDefineProperty(const uint64_t& objId, const JSIDVariant& id,
const PPropertyDescriptor &flags, ReturnStatus *rs) {
return Answer::RecvDefineProperty(ObjectId::deserialize(objId), id, flags, rs);
}
bool RecvDelete(const uint64_t& objId, const JSIDVariant& id,
ReturnStatus *rs) {
return Answer::RecvDelete(ObjectId::deserialize(objId), id, rs);
}
bool RecvHas(const uint64_t& objId, const JSIDVariant& id,
ReturnStatus* rs, bool* bp) {
return Answer::RecvHas(ObjectId::deserialize(objId), id, rs, bp);
}
bool RecvHasOwn(const uint64_t& objId, const JSIDVariant& id,
ReturnStatus* rs, bool* bp) {
return Answer::RecvHasOwn(ObjectId::deserialize(objId), id, rs, bp);
}
bool RecvGet(const uint64_t &objId, const ObjectVariant &receiverVar,
const JSIDVariant &id,
ReturnStatus *rs, JSVariant *result) {
return Answer::RecvGet(ObjectId::deserialize(objId), receiverVar, id, rs, result);
}
bool RecvSet(const uint64_t &objId, const JSIDVariant &id, const JSVariant &value,
const JSVariant &receiverVar, ReturnStatus *rs) {
return Answer::RecvSet(ObjectId::deserialize(objId), id, value, receiverVar, rs);
}
bool RecvIsExtensible(const uint64_t &objId, ReturnStatus *rs,
bool *result) {
return Answer::RecvIsExtensible(ObjectId::deserialize(objId), rs, result);
}
bool RecvCallOrConstruct(const uint64_t& objId, InfallibleTArray<JSParam>&& argv,
const bool& construct, ReturnStatus* rs, JSVariant* result,
nsTArray<JSParam>* outparams) {
return Answer::RecvCallOrConstruct(ObjectId::deserialize(objId), Move(argv), construct, rs, result, outparams);
}
bool RecvHasInstance(const uint64_t& objId, const JSVariant& v, ReturnStatus* rs, bool* bp) {
return Answer::RecvHasInstance(ObjectId::deserialize(objId), v, rs, bp);
}
bool RecvObjectClassIs(const uint64_t &objId, const uint32_t &classValue,
bool *result) {
return Answer::RecvObjectClassIs(ObjectId::deserialize(objId), classValue, result);
}
bool RecvClassName(const uint64_t &objId, nsString *result) {
return Answer::RecvClassName(ObjectId::deserialize(objId), result);
}
bool RecvGetPrototype(const uint64_t &objId, ReturnStatus *rs, ObjectOrNullVariant *result) {
return Answer::RecvGetPrototype(ObjectId::deserialize(objId), rs, result);
}
bool RecvRegExpToShared(const uint64_t &objId, ReturnStatus *rs, nsString *source, uint32_t *flags) {
return Answer::RecvRegExpToShared(ObjectId::deserialize(objId), rs, source, flags);
}
bool RecvGetPropertyKeys(const uint64_t &objId, const uint32_t &flags,
ReturnStatus *rs, nsTArray<JSIDVariant> *ids) {
return Answer::RecvGetPropertyKeys(ObjectId::deserialize(objId), flags, rs, ids);
}
bool RecvInstanceOf(const uint64_t& objId, const JSIID& iid,
ReturnStatus* rs, bool* instanceof) {
return Answer::RecvInstanceOf(ObjectId::deserialize(objId), iid, rs, instanceof);
}
bool RecvDOMInstanceOf(const uint64_t& objId, const int& prototypeID, const int& depth,
ReturnStatus* rs, bool* instanceof) {
return Answer::RecvDOMInstanceOf(ObjectId::deserialize(objId), prototypeID, depth, rs, instanceof);
}
bool RecvDropObject(const uint64_t& objId) {
return Answer::RecvDropObject(ObjectId::deserialize(objId));
}
/*** Dummy call handlers ***/
bool SendDropObject(const ObjectId &objId) {
return Base::SendDropObject(objId.serialize());
}
bool SendPreventExtensions(const ObjectId &objId, ReturnStatus *rs) {
return Base::SendPreventExtensions(objId.serialize(), rs);
}
bool SendGetPropertyDescriptor(const ObjectId &objId, const JSIDVariant& id,
ReturnStatus* rs,
PPropertyDescriptor* out) {
return Base::SendGetPropertyDescriptor(objId.serialize(), id, rs, out);
}
bool SendGetOwnPropertyDescriptor(const ObjectId& objId,
const JSIDVariant& id,
ReturnStatus* rs,
PPropertyDescriptor* out) {
return Base::SendGetOwnPropertyDescriptor(objId.serialize(), id, rs, out);
}
bool SendDefineProperty(const ObjectId& objId, const JSIDVariant& id,
const PPropertyDescriptor& flags,
ReturnStatus *rs) {
return Base::SendDefineProperty(objId.serialize(), id, flags, rs);
}
bool SendDelete(const ObjectId &objId, const JSIDVariant &id, ReturnStatus *rs) {
return Base::SendDelete(objId.serialize(), id, rs);
}
bool SendHas(const ObjectId& objId, const JSIDVariant& id,
ReturnStatus* rs, bool* bp) {
return Base::SendHas(objId.serialize(), id, rs, bp);
}
bool SendHasOwn(const ObjectId& objId, const JSIDVariant& id,
ReturnStatus* rs, bool* bp) {
return Base::SendHasOwn(objId.serialize(), id, rs, bp);
}
bool SendGet(const ObjectId &objId, const ObjectVariant &receiverVar,
const JSIDVariant &id,
ReturnStatus *rs, JSVariant *result) {
return Base::SendGet(objId.serialize(), receiverVar, id, rs, result);
}
bool SendSet(const ObjectId &objId, const JSIDVariant &id, const JSVariant &value,
const JSVariant &receiverVar, ReturnStatus *rs) {
return Base::SendSet(objId.serialize(), id, value, receiverVar, rs);
}
bool SendIsExtensible(const ObjectId &objId, ReturnStatus *rs,
bool *result) {
return Base::SendIsExtensible(objId.serialize(), rs, result);
}
bool SendCallOrConstruct(const ObjectId& objId, const nsTArray<JSParam>& argv,
const bool& construct, ReturnStatus* rs, JSVariant* result,
nsTArray<JSParam>* outparams) {
return Base::SendCallOrConstruct(objId.serialize(), argv, construct, rs, result, outparams);
}
bool SendHasInstance(const ObjectId& objId, const JSVariant& v, ReturnStatus* rs, bool* bp) {
return Base::SendHasInstance(objId.serialize(), v, rs, bp);
}
bool SendObjectClassIs(const ObjectId& objId, const uint32_t& classValue,
bool* result) {
return Base::SendObjectClassIs(objId.serialize(), classValue, result);
}
bool SendClassName(const ObjectId &objId, nsString *result) {
return Base::SendClassName(objId.serialize(), result);
}
bool SendGetPrototype(const ObjectId &objId, ReturnStatus *rs, ObjectOrNullVariant *result) {
return Base::SendGetPrototype(objId.serialize(), rs, result);
}
bool SendRegExpToShared(const ObjectId &objId, ReturnStatus *rs,
nsString *source, uint32_t *flags) {
return Base::SendRegExpToShared(objId.serialize(), rs, source, flags);
}
bool SendGetPropertyKeys(const ObjectId &objId, const uint32_t &flags,
ReturnStatus *rs, nsTArray<JSIDVariant> *ids) {
return Base::SendGetPropertyKeys(objId.serialize(), flags, rs, ids);
}
bool SendInstanceOf(const ObjectId& objId, const JSIID& iid,
ReturnStatus* rs, bool* instanceof) {
return Base::SendInstanceOf(objId.serialize(), iid, rs, instanceof);
}
bool SendDOMInstanceOf(const ObjectId& objId, const int& prototypeID, const int& depth,
ReturnStatus* rs, bool* instanceof) {
return Base::SendDOMInstanceOf(objId.serialize(), prototypeID, depth, rs, instanceof);
}
/* The following code is needed to suppress a bogus MSVC warning (C4250). */
virtual bool toObjectVariant(JSContext* cx, JSObject* obj, ObjectVariant* objVarp) {
return WrapperOwner::toObjectVariant(cx, obj, objVarp);
}
virtual JSObject* fromObjectVariant(JSContext* cx, ObjectVariant objVar) {
return WrapperOwner::fromObjectVariant(cx, objVar);
}
};
} // namespace jsipc
} // namespace mozilla
#endif