Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/jsc/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5444,7 +5444,10 @@ static void JSC__JSValue__forEachPropertyImpl(JSC::EncodedJSValue JSValue0, JSC:
break;
if (iterating == globalObject)
break;
iterating = iterating->getPrototype(globalObject).getObject();
JSValue proto = iterating->getPrototype(globalObject);
// Ignore exceptions from Proxy "getPrototype" trap.
CLEAR_IF_EXCEPTION(scope);
iterating = proto ? proto.getObject() : nullptr;
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/jsc/bindings/napi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,9 @@ extern "C" napi_status napi_get_all_property_names(
// Climb up the prototype chain to find inherited properties
JSObject* current_object = object;
while (!current_object->getOwnPropertyDescriptor(globalObject, key.toPropertyKey(globalObject), desc)) {
JSObject* proto = current_object->getPrototype(globalObject).getObject();
JSValue protoValue = current_object->getPrototype(globalObject);
NAPI_RETURN_IF_EXCEPTION(env);
JSObject* proto = protoValue.getObject();
if (!proto) {
break;
}
Expand Down
26 changes: 26 additions & 0 deletions test/js/bun/util/inspect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,32 @@ const fixture = [
},
},
),
() => {
const proto = new Proxy(
{},
{
getPrototypeOf() {
throw new Error("nope");
},
},
);
const obj = Object.create(proto);
obj[0] = 1;
return obj;
},
() => {
const proto = new Proxy(
{},
{
getPrototypeOf() {
throw new Error("nope");
},
},
);
const obj = Object.create(proto);
Object.defineProperty(obj, "x", { get: () => 1, enumerable: true, configurable: true });
return obj;
},
];

describe("crash testing", () => {
Expand Down
Loading