-
Notifications
You must be signed in to change notification settings - Fork 3
Use internal slot to store the stack trace #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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> | ||||||
|
|
||||||
|
|
@@ -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_. | ||||||
| 1. Perform ? DefinePropertyOrThrow(_O_, *"stack"*, PropertyDescriptor { [[Get]]: %ErrorCaptureStackTraceGetter%, [[Set]]: %ErrorCaptureStackTraceSetter%, [[Enumerable]]: false, [[Configurable]]: true }). | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 }). | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned in #15:
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||||||
There was a problem hiding this comment.
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.