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

オープン
#67,806 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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時間
マージ済み PR(30日)
266

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nodejs/node のほかの issue

nodejs/node の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。