| 151 | } |
| 152 | |
| 153 | bool PyObjectProxyHandler::set(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, |
| 154 | JS::HandleValue v, JS::HandleValue receiver, |
| 155 | JS::ObjectOpResult &result) const { |
| 156 | JS::RootedValue rootedV(cx, v); |
| 157 | PyObject *attrName = idToKey(cx, id); |
| 158 | |
| 159 | PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot); |
| 160 | PyObject *value = pyTypeFactory(cx, rootedV); |
| 161 | if (PyObject_SetAttr(self, attrName, value)) { |
| 162 | Py_DECREF(value); |
| 163 | return result.failCantSetInterposed(); // raises JS exception |
| 164 | } |
| 165 | Py_DECREF(value); |
| 166 | return result.succeed(); |
| 167 | } |
| 168 | |
| 169 | bool PyObjectProxyHandler::enumerate(JSContext *cx, JS::HandleObject proxy, |
| 170 | JS::MutableHandleIdVector props) const { |
nothing calls this directly
no test coverage detected