REPL error when previewing a getter property on the prototype chain that throws

未關閉
#67,806 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
58/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
javascript, node.js
領域
backend, cli

研究方向

Start in node:internal/repl/completion, especially propHasGetterOrIsProxy at line 791, where accessing the strict function's arguments property raises the reported TypeError. Reproduce the supplied input in the Node.js REPL and trace how completion handles that property access. Done means the REPL reports or warns about the error without exiting.

由索引模型根據 Issue 內容生成。

描述

repl v24.x v26.x
Version

v26.13.1

Platform
Darwin _ 23.6.0 Darwin Kernel Version 23.6.0: arm64
Subsystem

No response

What steps will reproduce the bug?
> node
Welcome to Node.js v26.13.1.
Type ".help" for more information.
> const Dog = new (
|    class {
|      speak() {
|       return 'woof';
|      }}
|    )();
undefined

The next line one enters Dog.constructor.arguments without a newline and exit occurs as shown:

> Dog.constructor.argumentsnode:internal/readline/emitKeypressEvents:74
            throw err;
            ^

TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at get arguments (<anonymous>)
    at propHasGetterOrIsProxy (node:internal/repl/completion:791:18)
    at hasGetterOrIsProxy (node:internal/repl/completion:740:14)
    at node:internal/repl/completion:684:16
    at node:internal/repl/completion:714:20
    at finishExecution (node:repl:588:9)
    at defaultEval (node:repl:682:9)
    at REPLEvalInContext (node:repl:693:9)
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_context_frame:66:14)
    at REPLEval (node:repl:692:19)
How often does it reproduce? Is there a required condition?

Reproducible using steps above.

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

The REPL shows an error or warning, but does not exit node.

What do you see instead?

Exit of node back to terminal.

Additional information

No response

主要語言
JavaScript
星號
124k
分支
38k
平均合併
4 天 2 小時
30 天內合併 PR
266

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

nodejs/node 的其他 Issue

查看 nodejs/node 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。