nodejs / nodejs/node

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

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

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

v8 module web-standards
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

このレポートは node:v8 serialize/deserialize を対象とし、AbortSignal.abort().reason で問題を再現します。まずそのラウンドトリップを追跡し、他の Error インスタンスと比較してください。DOMException が観測可能なデータを保持した DOMException としてシリアライズを通過し、報告された例をカバーする回帰テストがあることが完了の条件です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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