Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=4 sw=4 et tw=80: |
michael@0 | 3 | * |
michael@0 | 4 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 5 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 6 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef mozilla_jsipc_JavaScriptChild_h_ |
michael@0 | 9 | #define mozilla_jsipc_JavaScriptChild_h_ |
michael@0 | 10 | |
michael@0 | 11 | #include "JavaScriptShared.h" |
michael@0 | 12 | #include "mozilla/jsipc/PJavaScriptChild.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | namespace jsipc { |
michael@0 | 16 | |
michael@0 | 17 | class JavaScriptChild |
michael@0 | 18 | : public PJavaScriptChild, |
michael@0 | 19 | public JavaScriptShared |
michael@0 | 20 | { |
michael@0 | 21 | public: |
michael@0 | 22 | JavaScriptChild(JSRuntime *rt); |
michael@0 | 23 | ~JavaScriptChild(); |
michael@0 | 24 | |
michael@0 | 25 | bool init(); |
michael@0 | 26 | void trace(JSTracer *trc); |
michael@0 | 27 | |
michael@0 | 28 | bool RecvDropObject(const ObjectId &objId) MOZ_OVERRIDE; |
michael@0 | 29 | |
michael@0 | 30 | bool AnswerPreventExtensions(const ObjectId &objId, ReturnStatus *rs) MOZ_OVERRIDE; |
michael@0 | 31 | bool AnswerGetPropertyDescriptor(const ObjectId &objId, const nsString &id, |
michael@0 | 32 | ReturnStatus *rs, |
michael@0 | 33 | PPropertyDescriptor *out) MOZ_OVERRIDE; |
michael@0 | 34 | bool AnswerGetOwnPropertyDescriptor(const ObjectId &objId, |
michael@0 | 35 | const nsString &id, |
michael@0 | 36 | ReturnStatus *rs, |
michael@0 | 37 | PPropertyDescriptor *out) MOZ_OVERRIDE; |
michael@0 | 38 | bool AnswerDefineProperty(const ObjectId &objId, const nsString &id, |
michael@0 | 39 | const PPropertyDescriptor &flags, |
michael@0 | 40 | ReturnStatus *rs) MOZ_OVERRIDE; |
michael@0 | 41 | bool AnswerDelete(const ObjectId &objId, const nsString &id, |
michael@0 | 42 | ReturnStatus *rs, bool *success) MOZ_OVERRIDE; |
michael@0 | 43 | |
michael@0 | 44 | bool AnswerHas(const ObjectId &objId, const nsString &id, |
michael@0 | 45 | ReturnStatus *rs, bool *bp) MOZ_OVERRIDE; |
michael@0 | 46 | bool AnswerHasOwn(const ObjectId &objId, const nsString &id, |
michael@0 | 47 | ReturnStatus *rs, bool *bp) MOZ_OVERRIDE; |
michael@0 | 48 | bool AnswerGet(const ObjectId &objId, const ObjectId &receiverId, |
michael@0 | 49 | const nsString &id, |
michael@0 | 50 | ReturnStatus *rs, JSVariant *result) MOZ_OVERRIDE; |
michael@0 | 51 | bool AnswerSet(const ObjectId &objId, const ObjectId &receiverId, |
michael@0 | 52 | const nsString &id, const bool &strict, |
michael@0 | 53 | const JSVariant &value, ReturnStatus *rs, JSVariant *result) MOZ_OVERRIDE; |
michael@0 | 54 | |
michael@0 | 55 | bool AnswerIsExtensible(const ObjectId &objId, ReturnStatus *rs, |
michael@0 | 56 | bool *result) MOZ_OVERRIDE; |
michael@0 | 57 | bool AnswerCall(const ObjectId &objId, const nsTArray<JSParam> &argv, |
michael@0 | 58 | ReturnStatus *rs, JSVariant *result, |
michael@0 | 59 | nsTArray<JSParam> *outparams) MOZ_OVERRIDE; |
michael@0 | 60 | bool AnswerObjectClassIs(const ObjectId &objId, const uint32_t &classValue, |
michael@0 | 61 | bool *result) MOZ_OVERRIDE; |
michael@0 | 62 | bool AnswerClassName(const ObjectId &objId, nsString *result) MOZ_OVERRIDE; |
michael@0 | 63 | |
michael@0 | 64 | bool AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &flags, |
michael@0 | 65 | ReturnStatus *rs, nsTArray<nsString> *names) MOZ_OVERRIDE; |
michael@0 | 66 | bool AnswerInstanceOf(const ObjectId &objId, const JSIID &iid, |
michael@0 | 67 | ReturnStatus *rs, bool *instanceof) MOZ_OVERRIDE; |
michael@0 | 68 | bool AnswerDOMInstanceOf(const ObjectId &objId, const int &prototypeID, const int &depth, |
michael@0 | 69 | ReturnStatus *rs, bool *instanceof) MOZ_OVERRIDE; |
michael@0 | 70 | |
michael@0 | 71 | protected: |
michael@0 | 72 | JSObject *unwrap(JSContext *cx, ObjectId id); |
michael@0 | 73 | |
michael@0 | 74 | private: |
michael@0 | 75 | bool makeId(JSContext *cx, JSObject *obj, ObjectId *idp); |
michael@0 | 76 | bool fail(JSContext *cx, ReturnStatus *rs); |
michael@0 | 77 | bool ok(ReturnStatus *rs); |
michael@0 | 78 | |
michael@0 | 79 | private: |
michael@0 | 80 | ObjectId lastId_; |
michael@0 | 81 | JSRuntime *rt_; |
michael@0 | 82 | ObjectIdCache ids_; |
michael@0 | 83 | }; |
michael@0 | 84 | |
michael@0 | 85 | } // mozilla |
michael@0 | 86 | } // jsipc |
michael@0 | 87 | |
michael@0 | 88 | #endif |