From c7042eb560620eb2db9ccd257e605daab40672c6 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 9 Sep 2016 12:42:01 -0400 Subject: [PATCH 1/2] Change the named property visibility algorithm so that existing own props always make corresponding named props invisible. Fixes by picking option (1). --- index.bs | 16 ++-- index.html | 244 +++++++++++++++++++++++++---------------------------- 2 files changed, 120 insertions(+), 140 deletions(-) diff --git a/index.bs b/index.bs index 5d1df7df..b7700902 100644 --- a/index.bs +++ b/index.bs @@ -12200,16 +12200,14 @@ depending on whether the [{{OverrideBuiltins}}] operates as follows, with property name |P| and object |O|:
    - 1. If |P| is an [=unforgeable property name=] - on |O|, then return false. - 1. If |O| implements an [=interface=] with - an [{{Unforgeable}}]-annotated [=attribute=] - whose [=identifier=] is |P|, then return false. 1. If |P| is not a [=supported property name=] of |O|, then return false. + 1. If |O| has an own property named |P|, then return false. + + 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. + 1. If |O| implements an interface that has the [{{OverrideBuiltins}}] [=extended attribute=], then return true. - 1. If |O| has an own property named |P|, then return false. 1. Initialize |prototype| to be the value of the internal \[[Prototype]] property of |O|. 1. While |prototype| is not null: 1. If |prototype| is not a [=named properties object=], @@ -12223,16 +12221,12 @@ operates as follows, with property name |P| and object |O|: This should ensure that for objects with named properties, property resolution is done in the following order: 1. Indexed properties. - 1. Unforgeable attributes and operations. + 1. Own properties, including unforgeable attributes and operations. 1. Then, if [{{OverrideBuiltins}}]: 1. Named properties. - 1. Own properties. 1. Properties from the prototype chain. 1. Otherwise, if not [{{OverrideBuiltins}}]: - 1. Own properties. - 1. Properties from the prototype chain. - 1. Named properties. diff --git a/index.html b/index.html index 298dc083..926714b2 100644 --- a/index.html +++ b/index.html @@ -1963,7 +1963,7 @@

    attribute long something; }; -
    // This is an ECMAScript code block.
    +
    // This is an ECMAScript code block.
     window.onload = function() { window.alert("loaded"); };

    2. Conformance

    @@ -2397,7 +2397,7 @@