Skip to content

Commit 9ea873f

Browse files
bzbarskytobie
authored andcommitted
Change to named property visibility algorithm. (#174)
This ensures existing own props always make corresponding named props invisible. Fixes #152 by picking option (1).
1 parent 00c36be commit 9ea873f

File tree

2 files changed

+68
-88
lines changed

2 files changed

+68
-88
lines changed

index.bs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12200,16 +12200,14 @@ depending on whether the [{{OverrideBuiltins}}]
1220012200
operates as follows, with property name |P| and object |O|:
1220112201

1220212202
<ol class="algorithm">
12203-
1. If |P| is an [=unforgeable property name=]
12204-
on |O|, then return false.
12205-
1. If |O| implements an [=interface=] with
12206-
an [{{Unforgeable}}]-annotated [=attribute=]
12207-
whose [=identifier=] is |P|, then return false.
1220812203
1. If |P| is not a [=supported property name=]
1220912204
of |O|, then return false.
12205+
1. If |O| has an own property named |P|, then return false.
12206+
12207+
Note: This will include cases in which |O| has unforgeable properties, because in practice those are always set up before objects have any supported property names, and once set up will make the corresponding named properties invisible.
12208+
1221012209
1. If |O| implements an interface that has the [{{OverrideBuiltins}}]
1221112210
[=extended attribute=], then return true.
12212-
1. If |O| has an own property named |P|, then return false.
1221312211
1. Initialize |prototype| to be the value of the internal \[[Prototype]] property of |O|.
1221412212
1. While |prototype| is not null:
1221512213
1. If |prototype| is not a [=named properties object=],
@@ -12223,16 +12221,12 @@ operates as follows, with property name |P| and object |O|:
1222312221
This should ensure that for objects with named properties, property resolution is done in the following order:
1222412222

1222512223
1. Indexed properties.
12226-
1. Unforgeable attributes and operations.
12224+
1. Own properties, including unforgeable attributes and operations.
1222712225
1. Then, if [{{OverrideBuiltins}}]:
1222812226
1. Named properties.
12229-
1. Own properties.
1223012227
1. Properties from the prototype chain.
1223112228
1. Otherwise, if not [{{OverrideBuiltins}}]:
12232-
1. Own properties.
12233-
1223412229
1. Properties from the prototype chain.
12235-
1223612230
1. Named properties.
1223712231

1223812232
</div>

0 commit comments

Comments
 (0)