Skip to content

Commit

Permalink
Do not throw when cloning %ObjectPrototype%
Browse files Browse the repository at this point in the history
This matches the majority of existing implementations. The spec said it
should throw, but this was arguably accidental fallout from some
refactoring of the JavaScript specification.

Closes #5158.
  • Loading branch information
domenic authored Mar 20, 2020
1 parent 26c7197 commit 80e087c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2934,6 +2934,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x-href="https://tc39.es/ecma262/#running-execution-context">running JavaScript execution context</dfn></li>
<li><dfn data-x-href="https://tc39.es/ecma262/#surrounding-agent">surrounding agent</dfn></li>
<li><dfn data-x-href="https://tc39.es/ecma262/#sec-abstract-closure">abstract closure</dfn></li>
<li><dfn data-x-href="https://tc39.es/ecma262/#immutable-prototype-exotic-object">immutable prototype exotic object</dfn></li>
<li><dfn data-x-href="https://tc39.es/ecma262/#sec-well-known-symbols">Well-Known Symbols</dfn>, including
<dfn>@@hasInstance</dfn>,
<dfn>@@isConcatSpreadable</dfn>,
Expand All @@ -2945,6 +2946,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<dfn>%EvalErrorPrototype%</dfn>,
<dfn data-x-href="https://tc39.es/ecma262/#sec-properties-of-the-function-prototype-object">%FunctionPrototype%</dfn>,
<dfn data-x-href="https://tc39.es/ecma262/#sec-json.parse">%JSONParse%</dfn>,
<dfn data-x-href="https://tc39.es/ecma262/#sec-properties-of-the-object-prototype-object">%ObjectPrototype%</dfn>,
<dfn data-x-href="https://tc39.es/ecma262/#sec-object.prototype.valueof">%ObjProto_valueOf%</dfn>,
<dfn>%RangeErrorPrototype%</dfn>,
<dfn>%ReferenceErrorPrototype%</dfn>,
Expand Down Expand Up @@ -8446,8 +8448,10 @@ interface <dfn>DOMStringList</dfn> {
</li>

<li>
<p>Otherwise, if <var>value</var> is an exotic object, then throw a
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p>
<p>Otherwise, if <var>value</var> is an exotic object and <var>value</var> is not the
<span>%ObjectPrototype%</span> intrinsic object associated with any <span>JavaScript
realm</span>, then throw a <span>"<code>DataCloneError</code>"</span>
<code>DOMException</code>.</p>

<p class="example">For instance, a proxy object.</p>
</li>
Expand All @@ -8461,6 +8465,10 @@ interface <dfn>DOMStringList</dfn> {

<li><p>Set <var>deep</var> to true.</p></li>
</ol>

<p class="note"><span>%ObjectPrototype%</span> will end up being handled via this step and
subsequent steps. The end result is that its exoticness is ignored, and after deserialization
the result will be an empty object (not an <span>immutable prototype exotic object</span>).
</li>

<li><p><span data-x="map set">Set</span> <var>memory</var>[<var>value</var>] to
Expand Down

0 comments on commit 80e087c

Please sign in to comment.