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

Đang mở
#67,806 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript, node.js
Lĩnh vực
backend, cli

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
JavaScript
Star
124k
Fork
38k
Merge trung bình
4 ngày 2 giờ
Pull request đã merge (30 ngày)
266

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nodejs/node

Tất cả issue của nodejs/node

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.