Skip to content

Commit b6fa702

Browse files
'this' object for function calling on js object/array is js object/array not global
1 parent a9e3cc9 commit b6fa702

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/JSArrayProxy.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ PyObject *JSArrayProxyMethodDefinitions::JSArrayProxy_get(JSArrayProxy *self, Py
6363
if (methodName == NULL) { // reached end of list
6464
JS::RootedValue *value = new JS::RootedValue(GLOBAL_CX);
6565
JS_GetPropertyById(GLOBAL_CX, self->jsArray, id, value);
66-
JS::RootedObject *global = new JS::RootedObject(GLOBAL_CX, JS::GetNonCCWObjectGlobal(self->jsArray));
66+
JS::RootedObject *thisObj = new JS::RootedObject(GLOBAL_CX, self->jsArray);
6767
return pyTypeFactory(GLOBAL_CX, global, value)->getPyObject();
6868
}
6969
else if (PyUnicode_Check(key)) {
@@ -74,7 +74,7 @@ PyObject *JSArrayProxyMethodDefinitions::JSArrayProxy_get(JSArrayProxy *self, Py
7474
else {
7575
JS::RootedValue *value = new JS::RootedValue(GLOBAL_CX);
7676
JS_GetPropertyById(GLOBAL_CX, self->jsArray, id, value);
77-
JS::RootedObject *global = new JS::RootedObject(GLOBAL_CX, JS::GetNonCCWObjectGlobal(self->jsArray));
77+
JS::RootedObject *thisObj = new JS::RootedObject(GLOBAL_CX, self->jsArray);
7878
return pyTypeFactory(GLOBAL_CX, global, value)->getPyObject();
7979
}
8080
}

src/JSObjectProxy.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_get(JSObjectProxy *self,
9292
if (methodName == NULL) { // reached end of list
9393
JS::RootedValue *value = new JS::RootedValue(GLOBAL_CX);
9494
JS_GetPropertyById(GLOBAL_CX, self->jsObject, id, value);
95-
JS::RootedObject *global = new JS::RootedObject(GLOBAL_CX, JS::GetNonCCWObjectGlobal(self->jsObject));
96-
return pyTypeFactory(GLOBAL_CX, global, value)->getPyObject();
95+
JS::RootedObject *thisObj = new JS::RootedObject(GLOBAL_CX, self->jsObject);
96+
return pyTypeFactory(GLOBAL_CX, thisObj, value)->getPyObject();
9797
}
9898
else if (PyUnicode_Check(key)) {
9999
if (strcmp(methodName, PyUnicode_AsUTF8(key)) == 0) {
@@ -103,8 +103,7 @@ PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_get(JSObjectProxy *self,
103103
else {
104104
JS::RootedValue *value = new JS::RootedValue(GLOBAL_CX);
105105
JS_GetPropertyById(GLOBAL_CX, self->jsObject, id, value);
106-
JS::RootedObject *global = new JS::RootedObject(GLOBAL_CX, JS::GetNonCCWObjectGlobal(self->jsObject));
107-
106+
JS::RootedObject *thisObj = new JS::RootedObject(GLOBAL_CX, self->jsObject);
108107
return pyTypeFactory(GLOBAL_CX, global, value)->getPyObject();
109108
}
110109
}

0 commit comments

Comments
 (0)