nodejs / nodejs/node

`Cannot redefine property` when accessing properties of freezed global

未关闭
#46,788 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

confirmed-bug
主要语言
JavaScript
星标
122k
派生
37.3k
平均合并
4 天 2 小时
30 天内合并 PR
283

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用提供的 Object.freeze(global) 以及 MessageChannel 或 AbortController 命令,在 Node.js 19.3.0 中重现该问题。从堆栈跟踪中显示的 node:internal/util getter 和 setter 位置开始,然后验证访问冻结的 global 不再抛出异常,并且仍与 v19.2 的行为兼容。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。