From 75a7da9afc5bb8b8ea8dcd5234567b422888893b Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 2 Mar 2026 22:50:17 -0500 Subject: [PATCH 1/2] HTML integration for "Error Stack Accessor" TC39 Proposal Replace the non-normative "should" language about serializing "interesting accompanying data" with normative steps that explicitly serialize and deserialize the stack trace of Error objects during structured cloning. In StructuredSerializeInternal, the stack trace is obtained as an implementation-defined string and included in the serialized record as [[Stack]]. In StructuredDeserialize, the Error object is created with a [[Stack]] internal slot, which is set to an implementation-defined value representing the stack trace from the serialized record. This ensures the Error.prototype.stack accessor continues to work properly on deserialized errors. The bibliography is updated to reference both the Error Stack Accessor and Error Stacks proposals. This is the HTML integration PR for tc39/proposal-error-stack-accessor. See https://github.com/tc39/proposal-error-stack-accessor/issues/9 and https://github.com/tc39/proposal-error-stack-accessor/issues/8 --- source | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source b/source index a156a0f998c..5f5f0619937 100644 --- a/source +++ b/source @@ -10435,17 +10435,17 @@ interface DOMStringList { IsDataDescriptor(valueMessageDesc) is false, and ? ToString(valueMessageDesc.[[Value]]) otherwise.

-
  • Set serialized to { [[Type]]: "Error", [[Name]]: name, - [[Message]]: message }.

  • +
  • Let stack be an implementation-defined string that + represents the stack trace of value. JSERRORSTACKACCESSOR + JSERRORSTACKS

  • User agents should attach a serialized representation of any interesting accompanying data which are not yet specified, notably the stack property, to serialized.

    -

    See the Error Stacks proposal for in-progress work on specifying - this data. JSERRORSTACKS

    -
  • +
  • Set serialized to { [[Type]]: "Error", [[Name]]: name, + [[Message]]: message, [[Stack]]: stack }.

  • @@ -10897,7 +10897,7 @@ o.myself = o;
  • Let message be serialized.[[Message]].

  • Set value to OrdinaryObjectCreate(prototype, « - [[ErrorData]] »).

  • + [[ErrorData]], [[Stack]] »).

  • Let messageDesc be PropertyDescriptor { [[Value]]: message, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true @@ -10907,6 +10907,9 @@ o.myself = o; OrdinaryDefineOwnProperty(value, "message", messageDesc).

  • +
  • Set value.[[Stack]] to an implementation-defined string that represents + the stack trace serialized in serialized.[[Stack]].

  • +
  • Any interesting accompanying data attached to serialized should be deserialized and attached to value.

  • @@ -157150,8 +157153,11 @@ INSERT INTERFACES HERE
    [JPEG]
    JPEG File Interchange Format, E. Hamilton.
    +
    [JSERRORSTACKACCESSOR]
    +
    Error Stack Accessor. Ecma International.
    +
    [JSERRORSTACKS]
    -
    (Non-normative) Error Stacks. Ecma International.
    +
    Error Stacks. Ecma International.
    [JSDYNAMICCODEBRANDCHECKS]
    Dynamic code brand checks. Ecma International.
    From 0b68000d16ef4f1703cfbea59088620efb7b4eec Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 19 May 2026 10:41:47 +0200 Subject: [PATCH 2/2] Address review feedback - Access value.[[Stack]] in serialization (annevk) - Reorder: Set serialized before User agents should... step - Drop "notably the stack property" example from interesting accompanying data step (now explicit) (annevk) - Simplify deserialize: pass serialized.[[Stack]] through as-is rather than re-wrapping as implementation-defined (annevk) --- source | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/source b/source index 5f5f0619937..973948e43a7 100644 --- a/source +++ b/source @@ -10436,16 +10436,14 @@ interface DOMStringList { ? ToString(valueMessageDesc.[[Value]]) otherwise.

  • Let stack be an implementation-defined string that - represents the stack trace of value. JSERRORSTACKACCESSOR + represents value.[[Stack]]. JSERRORSTACKACCESSOR JSERRORSTACKS

  • -
  • -

    User agents should attach a serialized representation of any interesting accompanying - data which are not yet specified, notably the stack property, to - serialized.

    -
  • Set serialized to { [[Type]]: "Error", [[Name]]: name, [[Message]]: message, [[Stack]]: stack }.

  • + +
  • User agents should attach a serialized representation of any interesting accompanying + data which are not yet specified to serialized.

  • @@ -10907,8 +10905,7 @@ o.myself = o; OrdinaryDefineOwnProperty(value, "message", messageDesc).

    -
  • Set value.[[Stack]] to an implementation-defined string that represents - the stack trace serialized in serialized.[[Stack]].

  • +
  • Set value.[[Stack]] to serialized.[[Stack]].

  • Any interesting accompanying data attached to serialized should be deserialized and attached to value.