MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / ownPropertyKeys

Method ownPropertyKeys

src/PyListProxyHandler.cc:2138–2152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2136}
2137
2138bool PyListProxyHandler::ownPropertyKeys(JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const {
2139 // Modified from https://hg.mozilla.org/releases/mozilla-esr102/file/3b574e1/dom/base/RemoteOuterWindowProxy.cpp#l137
2140 PyObject *self = JS::GetMaybePtrFromReservedSlot<PyObject>(proxy, PyObjectSlot);
2141 int32_t length = PyList_Size(self);
2142 if (!props.reserve(length + 1)) {
2143 return false;
2144 }
2145 // item indexes
2146 for (int32_t i = 0; i < length; ++i) {
2147 props.infallibleAppend(JS::PropertyKey::Int(i));
2148 }
2149 // the "length" property
2150 props.infallibleAppend(JS::PropertyKey::NonIntAtom(JS_AtomizeString(cx, "length")));
2151 return true;
2152}
2153
2154bool PyListProxyHandler::delete_(JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::ObjectOpResult &result) const {
2155 Py_ssize_t index;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected