Skip to content

Commit

Permalink
Normative: Relax [[DefineOwnProperty]] on module namespace exotic obj…
Browse files Browse the repository at this point in the history
…ects.

[[DefineOwnProperty]] on module namespace exotic objects used to always
return false.  With this change, it returns true if, intuitively,
applying the given property descriptor wouldn't change anything.  This
is consistent with how [[DefineOwnProperty]] behaves for other kinds of
objects.

 - Special case for symbols.
 - Make OrdinaryDefineOwnProperty use IsExtensible.
  • Loading branch information
GeorgNeis authored and ljharb committed Mar 27, 2017
1 parent dd269df commit e4bfa86
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -6861,7 +6861,7 @@ <h1>OrdinaryDefineOwnProperty ( _O_, _P_, _Desc_ )</h1>
<p>When the abstract operation OrdinaryDefineOwnProperty is called with Object _O_, property key _P_, and Property Descriptor _Desc_, the following steps are taken:</p>
<emu-alg>
1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_).
1. Let _extensible_ be _O_.[[Extensible]].
1. Let _extensible_ be ? IsExtensible(_O_).
1. Return ValidateAndApplyPropertyDescriptor(_O_, _P_, _extensible_, _Desc_, _current_).
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -8488,7 +8488,15 @@ <h1>[[GetOwnProperty]] ( _P_ )</h1>
<h1>[[DefineOwnProperty]] ( _P_, _Desc_ )</h1>
<p>When the [[DefineOwnProperty]] internal method of a module namespace exotic object _O_ is called with property key _P_ and Property Descriptor _Desc_, the following steps are taken:</p>
<emu-alg>
1. Return *false*.
1. If Type(_P_) is Symbol, return OrdinaryDefineOwnProperty(_O_, _P_, _Desc_).
1. Let _current_ be ? _O_.[[GetOwnProperty]](_P_).
1. If _current_ is *undefined*, return *false*.
1. If IsAccessorDescriptor(_Desc_) is *true*, return *false*.
1. If _Desc_.[[Writable]] is present and has value *false*, return *false*.
1. If _Desc_.[[Enumerable]] is present and has value *false*, return *false*.
1. If _Desc_.[[Configurable]] is present and has value *true*, return *false*.
1. If _Desc_.[[Value]] is present, return SameValue(_Desc_.[[Value]], _current_.[[Value]]).
1. Return *true*.
</emu-alg>
</emu-clause>

Expand Down

0 comments on commit e4bfa86

Please sign in to comment.