Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 64 additions & 8 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,48 @@ markEffects: true
</emu-table>
</emu-clause>

<emu-clause id="sec-well-known-intrinsic-objects">
<h1>Well-Known Intrinsic Objects</h1>

<emu-table id="table-well-known-intrinsic-objects" caption="Well-Known Intrinsic Objects" oldids="table-7">
<table>
<thead>
<tr>
<th>
Intrinsic Name
</th>
<th>
Global Name
</th>
<th>
ECMAScript Language Association
</th>
</tr>
</thead>
<tr>
<td>
%ErrorCaptureStackTraceGetter%
</td>
<td>
</td>
<td>
The getter installed by `Error.captureStackTrace` (<emu-xref href="#sec-error.capturestacktrace-getter"></emu-xref>)
</td>
</tr>
<tr>
<td>
%ErrorCaptureStackTraceSetter%
</td>
<td>
</td>
<td>
The setter installed by `Error.captureStackTrace` (<emu-xref href="#sec-error.capturestacktrace-setter"></emu-xref>)
</td>
</tr>
</table>
</emu-table>
</emu-clause>

<emu-clause id="sec-fundamental-objects" number="20">
<h1>Fundamental Objects</h1>

Expand All @@ -66,17 +108,31 @@ markEffects: true
1. Perform ? DefinePropertyOrThrow(_O_, *"stack"*, PropertyDescriptor { [[Value]]: _string_, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }).
1. Else,
1. Assert: _strategy_ is ~accessor~.
1. Let _getterClosure_ be a new Abstract Closure with no parameters that captures _string_ and performs the following steps when called:
1. Return NormalCompletion(_string_).
1. Let _getter_ be CreateBuiltinFunction(_getterClosure_, 0, "", « »).
1. Let _setterClosure_ be a new Abstract Closure with parameters (_value_) that captures _O_ and performs the following steps when called:
1. Perform ? DefinePropertyOrThrow(_O_, *"stack"*, PropertyDescriptor { [[Value]]: _value_, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }).
1. Return NormalCompletion(*undefined*).
1. Let _setter_ be CreateBuiltinFunction(_setterClosure_, 1, "", « »).
1. Perform ? DefinePropertyOrThrow(_O_, *"stack"*, PropertyDescriptor { [[Get]]: _getter_, [[Set]]: _setter_, [[Enumerable]]: false, [[Configurable]]: true }).
1. If ? IsExtensible(_O_) is *false*, throw a *TypeError* exception.
1. Define a new [[ErrorStack]] internal slot on _O_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't match the [[StackTrace]] used by the getter.

I'm actually surprised we don't have a table of internal slots defined by the spec.

1. Perform ? DefinePropertyOrThrow(_O_, *"stack"*, PropertyDescriptor { [[Get]]: %ErrorCaptureStackTraceGetter%, [[Set]]: %ErrorCaptureStackTraceSetter%, [[Enumerable]]: false, [[Configurable]]: true }).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that the accessor is not enumerable where the data property is, any reason to have this difference?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching that, the accessor is not enumerable in the V8 implementation: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/execution/messages.cc;l=1233;drc=6b98c207facca73446d15164ad3f9a62f4b41d11 and the data property is non-enumerable in SpiderMonkey/JSC: https://searchfox.org/firefox-main/rev/48f8a74041be2973d7df8ded3ad5e64c2c00e8dd/js/src/vm/ErrorObject.cpp#1082-1088.

I'll fix the data property in the spec.

1. Return *undefined*.
</emu-alg>
</emu-clause>
<emu-clause id="sec-error.capturestacktrace-getter">
<h1>%ErrorCaptureStackTraceGetter% ( )</h1>
<p>The value of %ErrorCaptureStackTraceGetter% is a built-in function that takes no arguments. It performs the following steps when called:</p>
Comment on lines +118 to +119
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how it works editorially, but I think we need to at least define the observable name of these accessors.

<emu-alg>
1. Let _O_ be the *this* value.
1. If _O_ has a [[StackTrace]] internal slot, then
1. Return _O_.[[StackTrace]].
1. Else,
1. Return *undefined*.
</emu-alg>
</emu-clause>
<emu-clause id="sec-error.capturestacktrace-setter">
<h1>%ErrorCaptureStackTraceSetter% ( _value_ )</h1>
<p>The value of %ErrorCaptureStackTraceSetter% is a built-in function that takes an argument _value_. It performs the following steps when called:</p>
<emu-alg>
1. Perform ? DefinePropertyOrThrow(*this* value, *"stack"*, PropertyDescriptor { [[Value]]: _value_, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in #15:

Suggested change
1. Perform ? DefinePropertyOrThrow(*this* value, *"stack"*, PropertyDescriptor { [[Value]]: _value_, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }).
1. Perform ? DefinePropertyOrThrow(*this* value, *"stack"*, PropertyDescriptor { [[Value]]: _value_, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed this prior to merging, I'll address it in a follow up pr.

1. Return *undefined*.
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause>