From 30b35012d0d584e84bfa84c86f12f151ff944b8e Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Mon, 4 Dec 2023 10:25:55 -0700 Subject: [PATCH] make @@toStringTag and constructor prototype properties funky accessors (#287) --- spec.html | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/spec.html b/spec.html index c64c64d..df00d08 100644 --- a/spec.html +++ b/spec.html @@ -107,6 +107,30 @@

Well-Known Intrinsic Objects

Abstract Operations

+ +

+ SetterThatIgnoresPrototypeProperties ( + _home_: an Object, + _p_: a property key, + _v_: an ECMAScript language value, + ): either a normal completion containing ~unused~ or a throw completion +

+
+
+ + 1. Let _O_ be ? RequireObjectCoercible(*this* value). + 1. If _O_ is _home_, then + 1. NOTE: Throwing here emulates assignment to a non-writable data property on the _home_ object in strict mode code. + 1. Throw a *TypeError* exception. + 1. Let _desc_ be ? _O_.[[GetOwnProperty]](_p_). + 1. If _desc_ is *undefined*, then + 1. Perform ? CreateDataPropertyOrThrow(_O_, _p_, _v_). + 1. Else, + 1. Perform ? Set(_O_, _p_, _v_, *true*). + 1. Return ~unused~. + +
+

Operations on Iterator Objects

@@ -289,7 +313,28 @@

Iterator.prototype

Iterator.prototype.constructor

-

The initial value of %Iterator.prototype%.constructor is %Iterator%.

+

`Iterator.prototype.constructor` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }. The [[Get]] and [[Set]] attributes are defined as follows:

+ + +

get Iterator.prototype.constructor

+

The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps when called:

+ + 1. Return %Iterator%. + +
+ + +

set Iterator.prototype.constructor

+

The value of the [[Set]] attribute is a built-in function that takes an argument _v_. It performs the following steps when called:

+ + 1. Perform ? SetterThatIgnoresPrototypeProperties(%Iterator.prototype%, *"constructor"*, _v_). + 1. Return *undefined*. + +
+ + +

Unlike the *"constructor"* property on most built-in prototypes, for web-compatibility reasons this property must be an accessor.

+
@@ -563,9 +608,27 @@

Iterator.prototype.find ( _predicate_ )

Iterator.prototype [ @@toStringTag ]

-

The initial value of the @@toStringTag property is the String value "Iterator".

+

`Iterator.prototype[@@toStringTag]` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }. The [[Get]] and [[Set]] attributes are defined as follows:

+ + +

get Iterator.prototype [ @@toStringTag ]

+

The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps when called:

+ + 1. Return *"Iterator"*. + +
+ + +

set Iterator.prototype [ @@toStringTag ]

+

The value of the [[Set]] attribute is a built-in function that takes an argument _v_. It performs the following steps when called:

+ + 1. Perform ? SetterThatIgnoresPrototypeProperties(%Iterator.prototype%, %Symbol.toStringTag%, _v_). + 1. Return *undefined*. + +
+ -

Unlike the @@toStringTag on most built-in classes, for web-compatibility reasons this property must be writable.

+

Unlike the @@toStringTag property on most built-in prototypes, for web-compatibility reasons this property must be an accessor.