Skip to content

Commit

Permalink
Fix #16312 (#16322)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarred Sumner <[email protected]>
  • Loading branch information
pfgithub and Jarred-Sumner authored Jan 11, 2025
1 parent 96dc7ed commit b04ce67
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bun.js/bindings/JSPropertyIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ extern "C" JSPropertyIterator* Bun__JSPropertyIterator__create(JSC::JSGlobalObje
auto scope = DECLARE_THROW_SCOPE(vm);
JSC::PropertyNameArray array(vm, PropertyNameMode::StringsAndSymbols, PrivateSymbolMode::Exclude);

if (UNLIKELY(object->hasNonReifiedStaticProperties())) {
object->reifyAllStaticProperties(globalObject);
}

#if OS(WINDOWS)
if (UNLIKELY(object->type() == JSC::ProxyObjectType)) {
// Check if we're actually iterating through the JSEnvironmentVariableMap's proxy.
Expand Down Expand Up @@ -75,7 +79,7 @@ extern "C" JSPropertyIterator* Bun__JSPropertyIterator__create(JSC::JSGlobalObje
if (only_non_index_properties) {
object->getOwnNonIndexPropertyNames(globalObject, array, DontEnumPropertiesMode::Exclude);
} else {
object->getOwnPropertyNames(object, globalObject, array, DontEnumPropertiesMode::Exclude);
object->methodTable()->getOwnPropertyNames(object, globalObject, array, DontEnumPropertiesMode::Exclude);
}
} else {
object->getPropertyNames(globalObject, array, DontEnumPropertiesMode::Exclude);
Expand Down Expand Up @@ -161,7 +165,7 @@ extern "C" EncodedJSValue Bun__JSPropertyIterator__getNameAndValue(JSPropertyIte
auto& vm = iter->vm;
auto scope = DECLARE_THROW_SCOPE(vm);
PropertySlot slot(object, PropertySlot::InternalMethodType::GetOwnProperty);
if (!object->getOwnPropertySlot(object, globalObject, prop, slot)) {
if (!object->methodTable()->getOwnPropertySlot(object, globalObject, prop, slot)) {
return {};
}
RETURN_IF_EXCEPTION(scope, {});
Expand Down
Binary file modified test/bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"@remix-run/serve": "2.10.3",
"@resvg/resvg-js": "2.4.1",
"@swc/core": "1.3.38",
"@testing-library/jest-dom": "6.6.3",
"@testing-library/react": "16.1.0",
"aws-cdk-lib": "2.148.0",
"axios": "1.6.8",
"body-parser": "1.20.2",
Expand Down
13 changes: 13 additions & 0 deletions test/regression/issue/16312.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { test, afterEach, expect } from "bun:test";
import { cleanup } from "@testing-library/react";
import * as matchers from "@testing-library/jest-dom/matchers";

expect.extend(matchers);
afterEach(() => {
cleanup();
});

test("expect extended", () => {
// @ts-ignore
expect(expect.toBeInTheDocument).not.toBe(undefined);
});

0 comments on commit b04ce67

Please sign in to comment.