mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-27 06:29:15 +00:00
8fa1300bcd
- Bug 1136925 part 1. Stop passing a parent to JS_CloneObject (02806f3cb) - Bug 1136925 part 2. Stop passing a parent to Wrapper::New. (1d51cbd34) - Bug 1136925 part 3. Stop passing parents to js::NewProxyObject. (dc13db8da) - Bug 1136925 part 4. Stop passing parents to ProxyObject::New. (e2d30e340) - Bug 1130679: IonMonkey: Make it possible to guard on type changes/bailouts (ecec18313) - Bug 1136980 part 1. Get rid of JS_SetParent uses in DOM/XPConnect. (5cad9c256) - Bug 1136980 part 2. Remove JS_SetParent, even though we have a CLOSED TREE (96cf58c85) - Bug 1066229 - Part 5: Emitter support for basic ES6 ClassStatements. (e2a3cc979) - Bug 1135423 - Use unboxed objects for object literals where possible, clean up object literal creation and property initialization code (1d9e381c2) - Bug 1137523 part 2 - Unprefix a few js_* functions I forgot in part 1 (e6beaf0d8) - Bug 1135816 - Handle unboxed object receivers when compiling getter/setter calls in baseline/Ion (82233087e) - Bug 1138265 - TraceLogger: Throw error when trying to enable in AsmJS (64c799042) - Bug 1113369, part 1 - Introduce JS::ObjectOpResult and use it in js::StandardDefineProperty. (15663c476) - Bug 1113369, part 1½ - Avoid regressing error messages by adding obj to the ObjectOpResult methods that could throw a TypeError. (e063faf08) - Bug 1113369, part 2 - js::SetArrayLength ObjectOpResult support. (cf8326017) - Bug 1113369, part 3 - [[DefineOwnProperty]] ObjectOpResult support. (e16605a90) - Bug 1113369, part 4 - [[Set]] ObjectOpResult support. (6f94604d4) - Bug 1077002 - Give a better error message when showModalDialog is used (18d8ecc12) - Bug 1135792. Stop assuming that every binding for a global with a non-worker descriptor is a binding for Window. (dd0260c12) - Bug 1135810. Add more explicit checks for whether a descriptor wants Xrays or not instead of assuming that Xrays are desired if and only if descriptor.workers is false. (17ef71544) - Bug 1050456 - Part 1: Prevent prerendered pages from showing the slow script dialog (173044922) - Bug 1050456 - Part 2: Add a nsGlobalWindow::GetIsPrerendered helper (ac680a5f7) hopefully we can re-apply them later.
230 lines
10 KiB
C++
230 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,
|
|
bool* succeeded) {
|
|
return Answer::RecvPreventExtensions(ObjectId::deserialize(objId), rs,
|
|
succeeded);
|
|
}
|
|
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, bool* success) {
|
|
return Answer::RecvDelete(ObjectId::deserialize(objId), id, rs, success);
|
|
}
|
|
|
|
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 ObjectVariant& receiverVar,
|
|
const JSIDVariant& id, const bool& strict,
|
|
const JSVariant& value, ReturnStatus* rs, JSVariant* result) {
|
|
return Answer::RecvSet(ObjectId::deserialize(objId), receiverVar, id, strict, value, rs, result);
|
|
}
|
|
|
|
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 RecvGetPrototypeOf(const uint64_t& objId, ReturnStatus* rs, ObjectOrNullVariant* result) {
|
|
return Answer::RecvGetPrototypeOf(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,
|
|
bool* succeeded) {
|
|
return Base::SendPreventExtensions(objId.serialize(), rs, succeeded);
|
|
}
|
|
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, bool* success) {
|
|
return Base::SendDelete(objId.serialize(), id, rs, success);
|
|
}
|
|
|
|
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 ObjectVariant& receiverVar,
|
|
const JSIDVariant& id, const bool& strict,
|
|
const JSVariant& value, ReturnStatus* rs, JSVariant* result) {
|
|
return Base::SendSet(objId.serialize(), receiverVar, id, strict, value, rs, result);
|
|
}
|
|
|
|
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 SendGetPrototypeOf(const ObjectId& objId, ReturnStatus* rs, ObjectOrNullVariant* result) {
|
|
return Base::SendGetPrototypeOf(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
|