| 137 | } |
| 138 | |
| 139 | bool PyObjectProxyHandler::getOwnPropertyDescriptor( |
| 140 | JSContext *cx, JS::HandleObject proxy, JS::HandleId id, |
| 141 | JS::MutableHandle<mozilla::Maybe<JS::PropertyDescriptor>> desc |
| 142 | ) const { |
| 143 | PyObject *attrName = idToKey(cx, id); |
| 144 | PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot); |
| 145 | PyObject *item = PyObject_GetAttr(self, attrName); |
| 146 | if (!item && PyErr_ExceptionMatches(PyExc_AttributeError)) { |
| 147 | PyErr_Clear(); // clear error, we will be returning undefined in this case |
| 148 | } |
| 149 | |
| 150 | return handleGetOwnPropertyDescriptor(cx, id, desc, item); |
| 151 | } |
| 152 | |
| 153 | bool PyObjectProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, |
| 154 | JS::HandleValue v, JS::HandleValue receiver, |