nodejs / nodejs/node

`DOMException`s do not work with `v8.serialize()`

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

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

v8 module web-standards
Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.3k
Merge trung bình
4 ngày 2 giờ
Pull request đã merge (30 ngày)
283

Mô tả

Version

v22.1.0

Platform

Linux ether-laptop 6.5.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 26 11:23:57 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

node:v8

What steps will reproduce the bug?
import {serialize, deserialize} from 'node:v8';

const error = AbortSignal.abort().reason;
console.log(error instanceof DOMException); 
// true
console.log(error);
// DOMException [AbortError]: This operation was aborted
//     at new DOMException (node:internal/per_context/domexception:53:5)
//     at AbortSignal.abort (node:internal/abort_controller:205:14)
//     at ...

const clonedError = deserialize(serialize(error));
console.log(clonedError instanceof DOMException); 
// false
console.log(clonedError);
// {}
How often does it reproduce? Is there a required condition?

Always.

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

A DOMException should be serializable/deserializable like other error instances.

What do you see instead?

Serializing/deserializing with v8 turns it into an empty plain object.

Additional information

Related: structuredClone(domException) returns an empty plain object, which is probably the same bug. This might be related to #49181.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Báo cáo nhắm đến node:v8 serialize/deserialize và tái hiện vấn đề với AbortSignal.abort().reason; hãy bắt đầu bằng cách lần theo round trip đó và so sánh nó với các instance Error khác. Hoàn thành có nghĩa là DOMException vượt qua quá trình serialization dưới dạng một DOMException với dữ liệu có thể quan sát được vẫn được bảo toàn, cùng với một regression test bao quát ví dụ đã được báo cáo.

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

Đánh giá

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

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.