fix(jest): fix segfault when passing jest.fn into another jest.fn (#7507)

Close: #5900
This commit is contained in:
Hanaasagi
2023-12-07 16:41:31 +08:00
committed by GitHub
parent 1bf540efcf
commit dfd4b01a97
2 changed files with 17 additions and 0 deletions

View File

@@ -280,6 +280,8 @@ public:
if (lengthJSValue.isNumber()) {
this->putDirect(vm, vm.propertyNames->length, (lengthJSValue), JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::ReadOnly);
}
} else if (auto* fn = jsDynamicCast<JSMockFunction*>(value)) {
nameToUse = fn->get(global, vm.propertyNames->name).toWTFString(global);
} else if (auto* fn = jsDynamicCast<InternalFunction*>(value)) {
nameToUse = fn->name();
} else {