Skip to content

Commit

Permalink
Update to the ES2017 signature of [[DefineOwnProperty]].
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed May 11, 2016
1 parent 6ebdb96 commit 8c9b828
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 59 deletions.
92 changes: 63 additions & 29 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11401,17 +11401,15 @@ <h5>4.6.4.1. Named properties object [[GetOwnProperty]] method</h5>
<h5>4.6.4.2. Named properties object [[DefineOwnProperty]] method</h5>

<p>
The internal <span class="prop">[[DefineOwnProperty]]</span> method of every
When the internal <span class="prop">[[DefineOwnProperty]]</span> method of a
<a class="dfnref" href="#dfn-named-properties-object">named properties object</a>
<span class="rfc2119">MUST</span> behave as follows when called with object <var>O</var>
and property name <var>P</var>.
The term <span id="Reject">“Reject”</span> is used in the same sense as that defined in ECMA-262, namely, to mean “If <var>Throw</var> is
<span class="esvalue">true</span>, then <a href="#ecmascript-throw" class="dfnref external">throw a <span class="esvalue">TypeError</span></a> exception,
otherwise return <span class="esvalue">false</span>”.
<var>O</var> is called with property key <var>P</var> and
<a class="external" href="https://tc39.github.io/ecma262/#sec-property-descriptor-specification-type">Property Descriptor</a> (<a href="#ref-ECMA-262">[ECMA-262]</a>, section 6.2.4) <var>Desc</var>, the following steps
<span class="rfc2119">MUST</span> be taken:
</p>

<ol class="algorithm">
<li><a href="#Reject">Reject</a>.</li>
<li>Return <span class="esvalue">false</span>.</li>
</ol>
</div>

Expand Down Expand Up @@ -13769,24 +13767,37 @@ <h4>4.8.6. Platform object [[Set]] method</h4>
<h4>4.8.7. Platform object [[DefineOwnProperty]] method</h4>

<p>
The internal <span class="prop">[[DefineOwnProperty]]</span> method of every
<a class="dfnref" href="#dfn-platform-object">platform object</a> <var>O</var> that implements an <a class="dfnref" href="#dfn-interface">interface</a>
which <a class="dfnref" href="#dfn-support-indexed-properties">supports indexed</a> or
<a class="dfnref" href="#dfn-support-named-properties">named properties</a>
<span class="rfc2119">MUST</span> behave as follows when called with property name <var>P</var>,
Property Descriptor <var>Desc</var> and boolean flag <var>Throw</var>.
When the internal <span class="prop">[[DefineOwnProperty]]</span> method of a
<a class="dfnref" href="#dfn-platform-object">platform object</a> <var>O</var> that
implements an <a class="dfnref" href="#dfn-interface">interface</a> which
<a class="dfnref" href="#dfn-support-indexed-properties">supports indexed</a> or
<a class="dfnref" href="#dfn-support-named-properties">named properties</a> is
called with property key <var>P</var> and <a class="external" href="https://tc39.github.io/ecma262/#sec-property-descriptor-specification-type">Property Descriptor</a> (<a href="#ref-ECMA-262">[ECMA-262]</a>, section 6.2.4)
<var>Desc</var>, the following steps <span class="rfc2119">MUST</span> be taken:
</p>

<ol class="algorithm">
<li>
If <var>O</var> <a class="dfnref" href="#dfn-support-indexed-properties">supports indexed properties</a> and
<var>P</var> is an <a class="dfnref" href="#dfn-array-index-property-name">array index property name</a>, then:
<ol>
<li>If the result of calling <a class="external" href="https://tc39.github.io/ecma262/#sec-isdatadescriptor">IsDataDescriptor</a>(<var>Desc</var>) is <span class="esvalue">false</span>, then <a href="#Reject">Reject</a>.</li>
<li>If <var>O</var> does not implement an interface with an <a class="dfnref" href="#dfn-indexed-property-setter">indexed property setter</a>, then <a href="#Reject">Reject</a>.</li>
<li><a href="#invoking-indexed-setter">Invoke the indexed
property setter</a> with <var>P</var> and <var>Desc</var>.<span class="prop">[[Value]]</span>.</li>
<li>Return <span class="esvalue">true</span>.</li>
<li>
If the result of calling <a class="external" href="https://tc39.github.io/ecma262/#sec-isdatadescriptor">IsDataDescriptor</a>(<var>Desc</var>) is
<span class="esvalue">false</span>, then return
<span class="esvalue">false</span>.
</li>
<li>
If <var>O</var> does not implement an interface with an
<a class="dfnref" href="#dfn-indexed-property-setter">indexed property
setter</a>, then return <span class="esvalue">false</span>.
</li>
<li>
<a href="#invoking-indexed-setter">Invoke the indexed property setter</a> with
<var>P</var> and <var>Desc</var>.<span class="prop">[[Value]]</span>.
</li>
<li>
Return <span class="esvalue">true</span>.
</li>
</ol>
</li>

Expand All @@ -13802,27 +13813,50 @@ <h4>4.8.7. Platform object [[DefineOwnProperty]] method</h4>
<a class="dfnref" href="#dfn-extended-attribute">extended attribute</a> or <var>O</var> does not have an own property
named <var>P</var>, then:
<ol>
<li>If <var>creating</var> is false and <var>O</var> does not implement an interface with a <a class="dfnref" href="#dfn-named-property-setter">named property setter</a>, then <a href="#Reject">Reject</a>.</li>
<li>If <var>O</var> implements an interface with a <a class="dfnref" href="#dfn-named-property-setter">named property setter</a>, then:
<li>
If <var>creating</var> is false and <var>O</var> does not implement an
interface with a <a class="dfnref" href="#dfn-named-property-setter">named
property setter</a>, then return <span class="esvalue">false</span>.
</li>
<li>
If <var>O</var> implements an interface with a
<a class="dfnref" href="#dfn-named-property-setter">named property
setter</a>, then:
<ol>
<li>If the result of calling <a class="external" href="https://tc39.github.io/ecma262/#sec-isdatadescriptor">IsDataDescriptor</a>(<var>Desc</var>) is <span class="esvalue">false</span>, then <a href="#Reject">Reject</a>.</li>
<li>
<a href="#invoking-named-setter">Invoke the named
property setter</a> with <var>P</var> and
<var>Desc</var>.<span class="prop">[[Value]]</span>.
If the result of calling <a class="external" href="https://tc39.github.io/ecma262/#sec-isdatadescriptor">IsDataDescriptor</a>(<var>Desc</var>) is
<span class="esvalue">false</span>, then return
<span class="esvalue">false</span>.
</li>
<li>
<a href="#invoking-named-setter">Invoke the named property setter</a>
with <var>P</var> and
<var>Desc</var>.<span class="prop">[[Value]]</span>.
</li>
<li>
Return <span class="esvalue">true</span>.
</li>
<li>Return <span class="esvalue">true</span>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>

<li>If <var>O</var> does not implement an <a class="dfnref" href="#dfn-interface">interface</a> with the
<a class="xattr" href="#Global">[Global]</a> or <a class="xattr" href="#PrimaryGlobal">[PrimaryGlobal]</a> <a class="dfnref" href="#dfn-extended-attribute">extended attribute</a>,
then set <var>Desc</var>.<span class="prop">[[Configurable]]</span> to <span class="esvalue">true</span>.</li>
<li>Call the <a class="external" href="https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc">default <span class="prop">[[DefineOwnProperty]]</span> internal method</a> (<a href="#ref-ECMA-262">[ECMA-262]</a>, section 9.1.6) on <var>O</var> passing <var>P</var>, <var>Desc</var>, and <var>Throw</var> as arguments.</li>
<li>
If <var>O</var> does not implement an
<a class="dfnref" href="#dfn-interface">interface</a> with the
<a class="xattr" href="#Global">[Global]</a> or
<a class="xattr" href="#PrimaryGlobal">[PrimaryGlobal]</a>
<a class="dfnref" href="#dfn-extended-attribute">extended attribute</a>, then set
<var>Desc</var>.<span class="prop">[[Configurable]]</span> to
<span class="esvalue">true</span>.
</li>

<li>
Return <a class="external" href="https://tc39.github.io/ecma262/#sec-ordinarydefineownproperty">OrdinaryDefineOwnProperty</a>(<var>O</var>, <var>P</var>,
<var>Desc</var>).
</li>
</ol>
</div>

Expand Down
94 changes: 64 additions & 30 deletions index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<term name='Property Descriptor' class='external' href='https://tc39.github.io/ecma262/#sec-property-descriptor-specification-type' ref='ECMA-262' section='6.2.4'/>
<term name='array index' class='external' href='https://tc39.github.io/ecma262/#sec-array-exotic-objects' ref='ECMA-262' section='9.4.2'/>
<term name='default [[GetOwnProperty]] internal method' class='external' href='https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-getownproperty-p' ref='ECMA-262' section='9.1.5'/>
<term name='default [[DefineOwnProperty]] internal method' class='external' href='https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc' ref='ECMA-262' section='9.1.6'/>
<term name='OrdinaryDefineOwnProperty' class='external' href='https://tc39.github.io/ecma262/#sec-ordinarydefineownproperty'/>
<term name='default [[Set]] internal method' class='external' href='https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver' ref='ECMA-262' section='9.1.9'/>
<term name='equally close values' class='external' href='https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type' ref='ECMA-262' section='6.1.6'/>
<term name='internal slot' class='external' href='https://tc39.github.io/ecma262/#sec-object-internal-methods-and-internal-slots'/>
Expand Down Expand Up @@ -11272,17 +11272,15 @@ partial interface Window {
<h5>Named properties object [[DefineOwnProperty]] method</h5>

<p>
The internal <span class='prop'>[[DefineOwnProperty]]</span> method of every
When the internal <span class='prop'>[[DefineOwnProperty]]</span> method of a
<a class='dfnref' href='#dfn-named-properties-object'>named properties object</a>
<span class='rfc2119'>MUST</span> behave as follows when called with object <var>O</var>
and property name <var>P</var>.
The term <span id="Reject">“Reject”</span> is used in the same sense as that defined in ECMA-262, namely, to mean “If <var>Throw</var> is
<span class="esvalue">true</span>, then <a href="#ecmascript-throw" class="dfnref external">throw a <span class="esvalue">TypeError</span></a> exception,
otherwise return <span class="esvalue">false</span>”.
<var>O</var> is called with property key <var>P</var> and
<a>Property Descriptor</a> <var>Desc</var>, the following steps
<span class='rfc2119'>MUST</span> be taken:
</p>

<ol class='algorithm'>
<li><a href='#Reject'>Reject</a>.</li>
<li>Return <span class="esvalue">false</span>.</li>
</ol>
</div>

Expand Down Expand Up @@ -13651,24 +13649,37 @@ C implements A;</x:codeblock>
<h4>Platform object [[DefineOwnProperty]] method</h4>

<p>
The internal <span class='prop'>[[DefineOwnProperty]]</span> method of every
<a class='dfnref' href='#dfn-platform-object'>platform object</a> <var>O</var> that implements an <a class='dfnref' href='#dfn-interface'>interface</a>
which <a class='dfnref' href='#dfn-support-indexed-properties'>supports indexed</a> or
<a class='dfnref' href='#dfn-support-named-properties'>named properties</a>
<span class='rfc2119'>MUST</span> behave as follows when called with property name <var>P</var>,
Property Descriptor <var>Desc</var> and boolean flag <var>Throw</var>.
When the internal <span class='prop'>[[DefineOwnProperty]]</span> method of a
<a class='dfnref' href='#dfn-platform-object'>platform object</a> <var>O</var> that
implements an <a class='dfnref' href='#dfn-interface'>interface</a> which
<a class='dfnref' href='#dfn-support-indexed-properties'>supports indexed</a> or
<a class='dfnref' href='#dfn-support-named-properties'>named properties</a> is
called with property key <var>P</var> and <a>Property Descriptor</a>
<var>Desc</var>, the following steps <span class='rfc2119'>MUST</span> be taken:
</p>

<ol class='algorithm'>
<li>
If <var>O</var> <a class='dfnref' href='#dfn-support-indexed-properties'>supports indexed properties</a> and
<var>P</var> is an <a class='dfnref' href='#dfn-array-index-property-name'>array index property name</a>, then:
<ol>
<li>If the result of calling <a>IsDataDescriptor</a>(<var>Desc</var>) is <span class='esvalue'>false</span>, then <a href='#Reject'>Reject</a>.</li>
<li>If <var>O</var> does not implement an interface with an <a class='dfnref' href='#dfn-indexed-property-setter'>indexed property setter</a>, then <a href='#Reject'>Reject</a>.</li>
<li><a href='#invoking-indexed-setter'>Invoke the indexed
property setter</a> with <var>P</var> and <var>Desc</var>.<span class='prop'>[[Value]]</span>.</li>
<li>Return <span class='esvalue'>true</span>.</li>
<li>
If the result of calling <a>IsDataDescriptor</a>(<var>Desc</var>) is
<span class='esvalue'>false</span>, then return
<span class="esvalue">false</span>.
</li>
<li>
If <var>O</var> does not implement an interface with an
<a class='dfnref' href='#dfn-indexed-property-setter'>indexed property
setter</a>, then return <span class="esvalue">false</span>.
</li>
<li>
<a href='#invoking-indexed-setter'>Invoke the indexed property setter</a> with
<var>P</var> and <var>Desc</var>.<span class='prop'>[[Value]]</span>.
</li>
<li>
Return <span class='esvalue'>true</span>.
</li>
</ol>
</li>

Expand All @@ -13684,27 +13695,50 @@ C implements A;</x:codeblock>
<a class='dfnref' href='#dfn-extended-attribute'>extended attribute</a> or <var>O</var> does not have an own property
named <var>P</var>, then:
<ol>
<li>If <var>creating</var> is false and <var>O</var> does not implement an interface with a <a class='dfnref' href='#dfn-named-property-setter'>named property setter</a>, then <a href='#Reject'>Reject</a>.</li>
<li>If <var>O</var> implements an interface with a <a class='dfnref' href='#dfn-named-property-setter'>named property setter</a>, then:
<li>
If <var>creating</var> is false and <var>O</var> does not implement an
interface with a <a class='dfnref' href='#dfn-named-property-setter'>named
property setter</a>, then return <span class="esvalue">false</span>.
</li>
<li>
If <var>O</var> implements an interface with a
<a class='dfnref' href='#dfn-named-property-setter'>named property
setter</a>, then:
<ol>
<li>If the result of calling <a>IsDataDescriptor</a>(<var>Desc</var>) is <span class='esvalue'>false</span>, then <a href='#Reject'>Reject</a>.</li>
<li>
<a href='#invoking-named-setter'>Invoke the named
property setter</a> with <var>P</var> and
<var>Desc</var>.<span class='prop'>[[Value]]</span>.
If the result of calling <a>IsDataDescriptor</a>(<var>Desc</var>) is
<span class='esvalue'>false</span>, then return
<span class="esvalue">false</span>.
</li>
<li>
<a href='#invoking-named-setter'>Invoke the named property setter</a>
with <var>P</var> and
<var>Desc</var>.<span class='prop'>[[Value]]</span>.
</li>
<li>
Return <span class='esvalue'>true</span>.
</li>
<li>Return <span class='esvalue'>true</span>.</li>
</ol>
</li>
</ol>
</li>
</ol>
</li>

<li>If <var>O</var> does not implement an <a class='dfnref' href='#dfn-interface'>interface</a> with the
<a class='xattr' href='#Global'>[Global]</a> or <a class='xattr' href='#PrimaryGlobal'>[PrimaryGlobal]</a> <a class='dfnref' href='#dfn-extended-attribute'>extended attribute</a>,
then set <var>Desc</var>.<span class='prop'>[[Configurable]]</span> to <span class='esvalue'>true</span>.</li>
<li>Call the <a>default <span class='prop'>[[DefineOwnProperty]]</span> internal method</a> on <var>O</var> passing <var>P</var>, <var>Desc</var>, and <var>Throw</var> as arguments.</li>
<li>
If <var>O</var> does not implement an
<a class='dfnref' href='#dfn-interface'>interface</a> with the
<a class='xattr' href='#Global'>[Global]</a> or
<a class='xattr' href='#PrimaryGlobal'>[PrimaryGlobal]</a>
<a class='dfnref' href='#dfn-extended-attribute'>extended attribute</a>, then set
<var>Desc</var>.<span class='prop'>[[Configurable]]</span> to
<span class='esvalue'>true</span>.
</li>

<li>
Return <a>OrdinaryDefineOwnProperty</a>(<var>O</var>, <var>P</var>,
<var>Desc</var>).
</li>
</ol>
</div>

Expand Down

0 comments on commit 8c9b828

Please sign in to comment.