HTML integration for "Error Stack Accessor" TC39 Proposal#12239
HTML integration for "Error Stack Accessor" TC39 Proposal#12239ljharb wants to merge 1 commit intowhatwg:mainfrom
Conversation
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
There is other "interesting data" that should still be copied over, such as https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/lineNumber.
|
@nicolo-ribaudo should that be called out, or left implementation-defined? |
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 tc39/proposal-error-stack-accessor#9 and tc39/proposal-error-stack-accessor#8
a426672 to
9f15d18
Compare
|
The old spec text was:
You replaced it with explicit steps to copy
|
annevk
left a comment
There was a problem hiding this comment.
And yeah, let's preserve the "interesting accompanying data" step as well. Hopefully one day that won't be needed anymore.
| <li><p>Let <var>stack</var> be an <span>implementation-defined</span> string that represents the stack | ||
| trace of <var>value</var>. <ref>JSERRORSTACKACCESSOR</ref> <ref>JSERRORSTACKS</ref></p></li> |
|
|
||
| <li><p>Any interesting accompanying data attached to <var>serialized</var> should be | ||
| deserialized and attached to <var>value</var>.</p></li> | ||
| <li><p>Set <var>value</var>.[[Stack]] to an implementation-defined value that represents |
There was a problem hiding this comment.
xref implementation-defined. Although, can it literally be anything? We already serialized it to a string. Can it stay a string or do some implementations deserialize to an Array or Object? It would be nice if only one side had to be implementation-defined and we could at least agree on the value type.
There was a problem hiding this comment.
The user-visible value is always a string, but implementations can store any data structure they like there, and they will want to if https://github.com/tc39/proposal-error-stacks advances.
There was a problem hiding this comment.
But then let’s just serialize as an implementation-defined string and return that as-is here? Alternatively I suppose we could have implementation-defined on both sides but then we don’t have to require a string when serializing, but do need to require that here.
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 tc39/proposal-error-stack-accessor#9 and tc39/proposal-error-stack-accessor#8, as well as whatwg/webidl#1578
(See WHATWG Working Mode: Changes for more details.)
/references.html ( diff )
/structured-data.html ( diff )