`DOMException`s do not work with `v8.serialize()`
未关闭
还没有人认领这个 Issue。
v8 module
web-standards
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该报告针对 node:v8 serialize/deserialize,并使用 AbortSignal.abort().reason 重现该问题;首先跟踪这次往返过程,并将其与其他 Error 实例进行比较。完成的标准是 DOMException 以 DOMException 的形式通过序列化,并保留其可观察数据,同时有一个涵盖所报告示例的回归测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, node.js
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100