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

Method JSObjectProxy_copy_method

src/JSObjectProxy.cc:735–756  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733}
734
735PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_copy_method(JSObjectProxy *self) {
736 JS::Rooted<JS::ValueArray<2>> args(GLOBAL_CX);
737 args[0].setObjectOrNull(JS_NewPlainObject(GLOBAL_CX));
738 args[1].setObjectOrNull(*(self->jsObject));
739
740 JS::RootedObject global(GLOBAL_CX, JS::GetNonCCWObjectGlobal(*(self->jsObject)));
741
742 // call Object.assign
743 JS::RootedValue Object(GLOBAL_CX);
744 if (!JS_GetProperty(GLOBAL_CX, global, "Object", &Object)) {
745 PyErr_Format(PyExc_SystemError, "%s JSAPI call failed", JSObjectProxyType.tp_name);
746 return NULL;
747 }
748
749 JS::RootedObject rootedObject(GLOBAL_CX, Object.toObjectOrNull());
750 JS::RootedValue ret(GLOBAL_CX);
751 if (!JS_CallFunctionName(GLOBAL_CX, rootedObject, "assign", args, &ret)) {
752 PyErr_Format(PyExc_SystemError, "%s JSAPI call failed", JSObjectProxyType.tp_name);
753 return NULL;
754 }
755 return pyTypeFactory(GLOBAL_CX, ret);
756}
757
758PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_update_method(JSObjectProxy *self, PyObject *args, PyObject *kwds) {
759 PyObject *arg = NULL;

Callers

nothing calls this directly

Calls 1

pyTypeFactoryFunction · 0.85

Tested by

no test coverage detected