Skip to content

Inconsistent presence of property in contextified object #52720

Closed
@lachrist

Description

@lachrist

Version

v22.0.0

Platform

Darwin Laurents-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112 arm64

Subsystem

vm

What steps will reproduce the bug?

import { createContext, runInContext } from "vm";
console.log(
  runInContext(
    `
      "use strict";
      ({
        hasOwn: Object.hasOwn(globalThis, "toLocaleString"),
        descriptor: Reflect.getOwnPropertyDescriptor(globalThis, "toLocaleString"),
      });
    `,
    createContext(),
  ),
); // { hasOwn: true, descriptor: undefined }

Tested in both v22.0.0 and v20.12.2.

How often does it reproduce? Is there a required condition?

No required condition.

What is the expected behavior? Why is that the expected behavior?

Either the property is present or it is not. So either { hasOwn: false, descriptor: undefined} and { hasOwn: true, descriptor: { ... } } would be better.

What do you see instead?

{ hasOwn: true, descriptor: undefined }

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions