11#ifndef PythonMonkey_PyObjectProxy_
12#define PythonMonkey_PyObjectProxy_
40 static bool handleOwnPropertyKeys(JSContext *cx, PyObject *keys,
size_t length, JS::MutableHandleIdVector props);
53 JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc, PyObject *item);
61 void finalize(JS::GCContext *gcx, JSObject *proxy)
const override;
104 JS::MutableHandleIdVector props)
const override;
115 bool delete_(JSContext *cx, JS::HandleObject proxy, JS::HandleId
id,
116 JS::ObjectOpResult &result)
const override;
127 bool has(JSContext *cx, JS::HandleObject proxy, JS::HandleId
id,
128 bool *bp)
const override;
141 bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleId
id,
142 JS::HandleValue v, JS::HandleValue receiver,
143 JS::ObjectOpResult &result)
const override;
153 bool enumerate(JSContext *cx, JS::HandleObject proxy,
154 JS::MutableHandleIdVector props)
const override;
166 bool hasOwn(JSContext *cx, JS::HandleObject proxy, JS::HandleId
id,
167 bool *bp)
const override;
179 JSContext *cx, JS::HandleObject proxy,
180 JS::MutableHandleIdVector props)
const override;
183 JSContext *cx, JS::HandleObject proxy, JS::HandleId
id,
184 JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc
189 JS::Handle<JS::PropertyDescriptor> desc,
190 JS::ObjectOpResult &result)
const override;
192 bool getBuiltinClass(JSContext *cx, JS::HandleObject proxy, js::ESClass *cls)
const override;
Structs for creating JS proxy objects.
base class for PyDictProxyHandler and PyListProxyHandler
Definition PyBaseProxyHandler.hh:24
This struct is the ProxyHandler for JS Proxy Objects pythonmonkey creates to handle coercion from pyt...
Definition PyObjectProxyHandler.hh:24
static bool object_toLocaleString(JSContext *cx, unsigned argc, JS::Value *vp)
Helper function used by dicts and objects to convert dict/object to LocaleString.
bool getBuiltinClass(JSContext *cx, JS::HandleObject proxy, js::ESClass *cls) const override
Definition PyObjectProxyHandler.cc:196
bool enumerate(JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
[[Enumerate]]
Definition PyObjectProxyHandler.cc:169
PyObjectProxyHandler(const void *childFamily)
Definition PyObjectProxyHandler.hh:27
bool delete_(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::ObjectOpResult &result) const override
[[Delete]]
Definition PyObjectProxyHandler.cc:124
bool getOwnEnumerablePropertyKeys(JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
Returns vector of proxy's own keys.
Definition PyObjectProxyHandler.cc:182
void finalize(JS::GCContext *gcx, JSObject *proxy) const override
Handles python object reference count when JS Proxy object is finalized.
Definition PyObjectProxyHandler.cc:88
static bool object_toString(JSContext *cx, unsigned argc, JS::Value *vp)
Helper function used by dicts and objects to convert dict/object to String.
bool ownPropertyKeys(JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override
[[OwnPropertyKeys]]
Definition PyObjectProxyHandler.cc:98
bool getOwnPropertyDescriptor(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > > desc) const override
Definition PyObjectProxyHandler.cc:139
static bool object_valueOf(JSContext *cx, unsigned argc, JS::Value *vp)
Helper function used by dicts and objects to get valueOf, just returns a new reference to self
bool has(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp) const override
[[HasProperty]]
Definition PyObjectProxyHandler.cc:134
PyObjectProxyHandler()
Definition PyObjectProxyHandler.hh:26
bool defineProperty(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::Handle< JS::PropertyDescriptor > desc, JS::ObjectOpResult &result) const override
Definition PyObjectProxyHandler.cc:188
static const char family
Definition PyObjectProxyHandler.hh:28
static bool handleOwnPropertyKeys(JSContext *cx, PyObject *keys, size_t length, JS::MutableHandleIdVector props)
Helper function used by dicts and objects for ownPropertyKeys.
Definition PyObjectProxyHandler.cc:28
bool set(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::HandleValue v, JS::HandleValue receiver, JS::ObjectOpResult &result) const override
[[Set]]
Definition PyObjectProxyHandler.cc:153
static bool handleGetOwnPropertyDescriptor(JSContext *cx, JS::HandleId id, JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > > desc, PyObject *item)
Helper function used by dicts and objects for get OwnPropertyDescriptor.
Definition PyObjectProxyHandler.cc:44
bool hasOwn(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, bool *bp) const override
Returns true if id is in proxy, false otherwise.
Definition PyObjectProxyHandler.cc:174