diff --git a/index.html b/index.html index a45cf15..ab6ce82 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,17 @@ - + Error Stacks
+

Stage 1 Draft / February 8, 2024

Error Stacks

+

Stage 1 Draft / March 27, 2025

Error Stacks

1 System

@@ -3018,7 +3751,7 @@

1.2 System.getStackString ( error )

2 GetStack ( error )

When the abstract operation GetStack is called with argument error, the following steps are performed:

-
  1. Assert: error has an [[ErrorData]] internal slot.
  2. Let frames be ! GetStackFrames(error).
  3. Let string be ? GetStackString(error).
  4. Let obj be OrdinaryObjectCreate(%ObjectPrototype%).
  5. Perform ! CreateDataProperty(obj, "frames", frames).
  6. Assert: The above CreateDataProperty operation returns true.
  7. Perform ! CreateDataProperty(obj, "string", string).
  8. Assert: The above CreateDataProperty operation returns true.
  9. Let status be ! SetIntegrityLevel(obj, frozen).
  10. Assert: status is true.
  11. Return obj.
+
  1. Assert: error has an [[ErrorData]] internal slot.
  2. Let frames be ! GetStackFrames(error).
  3. Let string be ? GetStackString(error).
  4. Let obj be OrdinaryObjectCreate(%ObjectPrototype%).
  5. Perform ! CreateDataPropertyOrThrow(obj, "frames", frames).
  6. Perform ! CreateDataPropertyOrThrow(obj, "string", string).
  7. Let status be ! SetIntegrityLevel(obj, frozen).
  8. Assert: status is true.
  9. Return obj.
@@ -3075,7 +3808,7 @@

8.3 IsStackFramePosition ( position )

8.4 FromStackFrame ( frame )

When the abstract operation FromStackFrame is called with Stack Frame frame, the following steps are taken:

-
  1. Assert: ! IsStackFrame(frame) is true.
  2. Let obj be OrdinaryObjectCreate(%ObjectPrototype%).
  3. Assert: obj is an extensible ordinary object with no own properties.
  4. Perform ! CreateDataProperty(obj, "name", frame.[[Name]]).
  5. Let source be frame.[[Source]].
  6. If source is a String, then
    1. Perform ! CreateDataProperty(obj, "source", source).
  7. Else,
    1. Assert: ! IsStackFrame(source) is true.
    2. Perform ! CreateDataProperty(obj, "source", ! FromStackFrame(source)).
  8. Perform ! CreateDataProperty(obj, "span", ! FromStackFrameSpan(frame.[[Span]])).
  9. Assert: All of the above CreateDataProperty operations return true.
  10. Let status be ! SetIntegrityLevel(obj, frozen).
  11. Assert: status is true.
  12. Return obj.
+
  1. Assert: ! IsStackFrame(frame) is true.
  2. Let obj be OrdinaryObjectCreate(%ObjectPrototype%).
  3. Assert: obj is an extensible ordinary object with no own properties.
  4. Perform ! CreateDataPropertyOrThrow(obj, "name", frame.[[Name]]).
  5. Let source be frame.[[Source]].
  6. If source is a String, then
    1. Perform ! CreateDataPropertyOrThrow(obj, "source", source).
  7. Else,
    1. Assert: ! IsStackFrame(source) is true.
    2. Perform ! CreateDataPropertyOrThrow(obj, "source", ! FromStackFrame(source)).
  8. Perform ! CreateDataPropertyOrThrow(obj, "span", ! FromStackFrameSpan(frame.[[Span]])).
  9. Let status be ! SetIntegrityLevel(obj, frozen).
  10. Assert: status is true.
  11. Return obj.
@@ -3092,35 +3825,39 @@

8.6 FromStackFramePosition ( position -

A Placeholder to ensure correct annex lettering

+

Annex A (informative) Placeholder to ensure correct annex lettering

- -

B Additional Built-in Properties

-

When the ECMAScript host is a web browser the following additional properties of the standard built-in objects are defined.

- - -

B.1 Additional Properties of the Error.prototype Object

- - -

B.1.1 get Error.prototype.stack ( )

-

Error.prototype.stack is an accessor property whose get accessor function performs the following steps:

-
  1. Let E be the this value.
  2. If Type(E) is not Object, throw a TypeError exception.
  3. If E does not have an [[ErrorData]] internal slot, return undefined.
  4. Return ? GetStackString(error).
-

The value of the "name" property of this function is "get stack".

-
- - -

B.1.2 set Error.prototype.stack ( value )

-

Its set accessor function performs the following steps:

-
  1. Let E be the this value.
  2. If Type(E) is not Object, throw a TypeError exception.
  3. Let numberOfArgs be the number of arguments passed to this function call.
  4. If numberOfArgs is 0, throw a TypeError exception.
  5. Return ? CreateDataPropertyOrThrow(E, "stack", value).
-

The value of the "name" property of this function is "set stack".

+ +

Annex B (normative) Additional ECMAScript Features for Web Browsers

+ + +

B.1 Additional Built-in Properties

+

When the ECMAScript host is a web browser the following additional properties of the standard built-in objects are defined.

+ + +

B.1.1 Additional Properties of the Error.prototype Object

+ + +

B.1.1.1 get Error.prototype.stack ( )

+

Error.prototype.stack is an accessor property whose get accessor function performs the following steps:

+
  1. Let E be the this value.
  2. If Type(E) is not Object, throw a TypeError exception.
  3. If E does not have an [[ErrorData]] internal slot, return undefined.
  4. Return ? GetStackString(error).
+

The value of the "name" property of this function is "get stack".

+
+ + +

B.1.1.2 set Error.prototype.stack ( value )

+

Its set accessor function performs the following steps:

+
  1. Let E be the this value.
  2. If Type(E) is not Object, throw a TypeError exception.
  3. Let numberOfArgs be the number of arguments passed to this function call.
  4. If numberOfArgs is 0, throw a TypeError exception.
  5. Return ? CreateDataPropertyOrThrow(E, "stack", value).
+

The value of the "name" property of this function is "set stack".

+
-
-

C Copyright & Software License

+
+

Copyright & Software License

Copyright Notice

-

© 2024 Jordan Harband, Mark Miller

+

© 2025 Jordan Harband, Mark Miller

Software License

All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.

diff --git a/package.json b/package.json index 1af608e..155fc0e 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "in-publish": "^2.0.1" }, "devDependencies": { - "@tc39/ecma262-biblio": "^2.1.2682", - "ecmarkup": "^18.1.3" + "@tc39/ecma262-biblio": "2.1.2771", + "ecmarkup": "^21.0.0" } } diff --git a/spec.emu b/spec.emu index e3857bf..3855908 100644 --- a/spec.emu +++ b/spec.emu @@ -215,36 +215,40 @@ contributors: Jordan Harband, Mark Miller

Placeholder to ensure correct annex lettering

- -

Additional Built-in Properties

-

When the ECMAScript host is a web browser the following additional properties of the standard built-in objects are defined.

- - -

Additional Properties of the Error.prototype Object

- - -

get Error.prototype.stack ( )

-

*Error.prototype.stack* is an accessor property whose get accessor function performs the following steps:

- - 1. Let _E_ be the *this* value. - 1. If Type(_E_) is not Object, throw a *TypeError* exception. - 1. If _E_ does not have an [[ErrorData]] internal slot, return *undefined*. - 1. Return ? GetStackString(_error_). - -

The value of the *"name"* property of this function is *"get stack"*.

-
- - -

set Error.prototype.stack ( _value_ )

-

Its set accessor function performs the following steps:

- - 1. Let _E_ be the *this* value. - 1. If Type(_E_) is not Object, throw a *TypeError* exception. - 1. Let _numberOfArgs_ be the number of arguments passed to this function call. - 1. If _numberOfArgs_ is 0, throw a *TypeError* exception. - 1. Return ? CreateDataPropertyOrThrow(_E_, *"stack"*, _value_). - -

The value of the *"name"* property of this function is *"set stack"*.

+ +

Additional ECMAScript Features for Web Browsers

+ + +

Additional Built-in Properties

+

When the ECMAScript host is a web browser the following additional properties of the standard built-in objects are defined.

+ + +

Additional Properties of the Error.prototype Object

+ + +

get Error.prototype.stack ( )

+

*Error.prototype.stack* is an accessor property whose get accessor function performs the following steps:

+ + 1. Let _E_ be the *this* value. + 1. If Type(_E_) is not Object, throw a *TypeError* exception. + 1. If _E_ does not have an [[ErrorData]] internal slot, return *undefined*. + 1. Return ? GetStackString(_error_). + +

The value of the *"name"* property of this function is *"get stack"*.

+
+ + +

set Error.prototype.stack ( _value_ )

+

Its set accessor function performs the following steps:

+ + 1. Let _E_ be the *this* value. + 1. If Type(_E_) is not Object, throw a *TypeError* exception. + 1. Let _numberOfArgs_ be the number of arguments passed to this function call. + 1. If _numberOfArgs_ is 0, throw a *TypeError* exception. + 1. Return ? CreateDataPropertyOrThrow(_E_, *"stack"*, _value_). + +

The value of the *"name"* property of this function is *"set stack"*.

+