aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-04 08:05:57 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-04 08:05:57 -0800
commit69114ac0a9edc79bf95768666dac88d60bffb3b3 (patch)
tree695400b9a6880f195e4402cb35c35fa38da40a43
parent8830cbc51e80cd6aa690713aa68d3e55b0de25d9 (diff)
downloadbun-69114ac0a9edc79bf95768666dac88d60bffb3b3.tar.gz
bun-69114ac0a9edc79bf95768666dac88d60bffb3b3.tar.zst
bun-69114ac0a9edc79bf95768666dac88d60bffb3b3.zip
Fix console.log sometimes incorrectly reporting undefined
cc @Electroid
-rw-r--r--src/bun.js/bindings/bindings.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp
index 68abf7882..1ea403523 100644
--- a/src/bun.js/bindings/bindings.cpp
+++ b/src/bun.js/bindings/bindings.cpp
@@ -3439,7 +3439,7 @@ restart:
if (key.len == 0)
return true;
- JSC::JSValue propertyValue = objectToUse->getDirect(entry.offset());
+ JSC::JSValue propertyValue = objectToUse == object ? objectToUse->getDirect(entry.offset()) : JSValue();
if (!propertyValue || propertyValue.isGetterSetter()) {
propertyValue = objectToUse->get(globalObject, entry.key());
}
@@ -3495,8 +3495,8 @@ restart:
if (property == vm.propertyNames->constructor || clientData->builtinNames().bunNativePtrPrivateName() == property)
continue;
- JSC::PropertySlot slot(iterating, PropertySlot::InternalMethodType::Get);
- if (!iterating->getPropertySlot(globalObject, property, slot))
+ JSC::PropertySlot slot(object, PropertySlot::InternalMethodType::Get);
+ if (!object->getPropertySlot(globalObject, property, slot))
continue;
if ((slot.attributes() & PropertyAttribute::Accessor) != 0) {
@@ -3519,7 +3519,7 @@ restart:
if (slot.attributes() & PropertyAttribute::BuiltinOrFunction) {
propertyValue = slot.getValue(globalObject, property);
} else if (slot.isCustom()) {
- propertyValue = slot.internalMethodType() == PropertySlot::InternalMethodType::Get || slot.internalMethodType() == PropertySlot::InternalMethodType::HasProperty ? slot.getValue(globalObject, property) : jsUndefined();
+ propertyValue = slot.getValue(globalObject, property);
} else if (slot.isValue()) {
propertyValue = slot.getValue(globalObject, property);
} else if (object->getOwnPropertySlot(object, globalObject, property, slot)) {