1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/ipc/JavaScriptChild.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,88 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=4 sw=4 et tw=80: 1.6 + * 1.7 + * This Source Code Form is subject to the terms of the Mozilla Public 1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.10 + 1.11 +#ifndef mozilla_jsipc_JavaScriptChild_h_ 1.12 +#define mozilla_jsipc_JavaScriptChild_h_ 1.13 + 1.14 +#include "JavaScriptShared.h" 1.15 +#include "mozilla/jsipc/PJavaScriptChild.h" 1.16 + 1.17 +namespace mozilla { 1.18 +namespace jsipc { 1.19 + 1.20 +class JavaScriptChild 1.21 + : public PJavaScriptChild, 1.22 + public JavaScriptShared 1.23 +{ 1.24 + public: 1.25 + JavaScriptChild(JSRuntime *rt); 1.26 + ~JavaScriptChild(); 1.27 + 1.28 + bool init(); 1.29 + void trace(JSTracer *trc); 1.30 + 1.31 + bool RecvDropObject(const ObjectId &objId) MOZ_OVERRIDE; 1.32 + 1.33 + bool AnswerPreventExtensions(const ObjectId &objId, ReturnStatus *rs) MOZ_OVERRIDE; 1.34 + bool AnswerGetPropertyDescriptor(const ObjectId &objId, const nsString &id, 1.35 + ReturnStatus *rs, 1.36 + PPropertyDescriptor *out) MOZ_OVERRIDE; 1.37 + bool AnswerGetOwnPropertyDescriptor(const ObjectId &objId, 1.38 + const nsString &id, 1.39 + ReturnStatus *rs, 1.40 + PPropertyDescriptor *out) MOZ_OVERRIDE; 1.41 + bool AnswerDefineProperty(const ObjectId &objId, const nsString &id, 1.42 + const PPropertyDescriptor &flags, 1.43 + ReturnStatus *rs) MOZ_OVERRIDE; 1.44 + bool AnswerDelete(const ObjectId &objId, const nsString &id, 1.45 + ReturnStatus *rs, bool *success) MOZ_OVERRIDE; 1.46 + 1.47 + bool AnswerHas(const ObjectId &objId, const nsString &id, 1.48 + ReturnStatus *rs, bool *bp) MOZ_OVERRIDE; 1.49 + bool AnswerHasOwn(const ObjectId &objId, const nsString &id, 1.50 + ReturnStatus *rs, bool *bp) MOZ_OVERRIDE; 1.51 + bool AnswerGet(const ObjectId &objId, const ObjectId &receiverId, 1.52 + const nsString &id, 1.53 + ReturnStatus *rs, JSVariant *result) MOZ_OVERRIDE; 1.54 + bool AnswerSet(const ObjectId &objId, const ObjectId &receiverId, 1.55 + const nsString &id, const bool &strict, 1.56 + const JSVariant &value, ReturnStatus *rs, JSVariant *result) MOZ_OVERRIDE; 1.57 + 1.58 + bool AnswerIsExtensible(const ObjectId &objId, ReturnStatus *rs, 1.59 + bool *result) MOZ_OVERRIDE; 1.60 + bool AnswerCall(const ObjectId &objId, const nsTArray<JSParam> &argv, 1.61 + ReturnStatus *rs, JSVariant *result, 1.62 + nsTArray<JSParam> *outparams) MOZ_OVERRIDE; 1.63 + bool AnswerObjectClassIs(const ObjectId &objId, const uint32_t &classValue, 1.64 + bool *result) MOZ_OVERRIDE; 1.65 + bool AnswerClassName(const ObjectId &objId, nsString *result) MOZ_OVERRIDE; 1.66 + 1.67 + bool AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &flags, 1.68 + ReturnStatus *rs, nsTArray<nsString> *names) MOZ_OVERRIDE; 1.69 + bool AnswerInstanceOf(const ObjectId &objId, const JSIID &iid, 1.70 + ReturnStatus *rs, bool *instanceof) MOZ_OVERRIDE; 1.71 + bool AnswerDOMInstanceOf(const ObjectId &objId, const int &prototypeID, const int &depth, 1.72 + ReturnStatus *rs, bool *instanceof) MOZ_OVERRIDE; 1.73 + 1.74 + protected: 1.75 + JSObject *unwrap(JSContext *cx, ObjectId id); 1.76 + 1.77 + private: 1.78 + bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp); 1.79 + bool fail(JSContext *cx, ReturnStatus *rs); 1.80 + bool ok(ReturnStatus *rs); 1.81 + 1.82 + private: 1.83 + ObjectId lastId_; 1.84 + JSRuntime *rt_; 1.85 + ObjectIdCache ids_; 1.86 +}; 1.87 + 1.88 +} // mozilla 1.89 +} // jsipc 1.90 + 1.91 +#endif