nodejs / nodejs/node

`Cannot redefine property` when accessing properties of freezed global

Open
#46,788 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

confirmed-bug
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

19.3.0

Platform

Darwin * 21.6.0 Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

Run node and enter
Object.freeze(global);console.log(AbortController)
or
Object.freeze(global);console.log(MessageChannel)

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

since v19.3

What is the expected behavior?

No error, just like for v19.2

What do you see instead?
Welcome to Node.js v19.3.0.
Type ".help" for more information.
> Object.freeze(global);console.log(MessageChannel)
Uncaught TypeError: Cannot redefine property: MessageChannel
    at defineProperty (<anonymous>)
    at set MessageChannel (node:internal/util:511:7)
    at get MessageChannel (node:internal/util:525:9)
Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in Node.js 19.3.0 with the provided Object.freeze(global) and MessageChannel or AbortController commands. Start at the node:internal/util getter and setter locations shown in the stack trace, then verify that accessing the frozen global no longer throws and remains compatible with the v19.2 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.