Skip to content

Commit 80e087c

Browse files
authored
Do not throw when cloning %ObjectPrototype%
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.
1 parent 26c7197 commit 80e087c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

source

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2934,6 +2934,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
29342934
<li><dfn data-x-href="https://tc39.es/ecma262/#running-execution-context">running JavaScript execution context</dfn></li>
29352935
<li><dfn data-x-href="https://tc39.es/ecma262/#surrounding-agent">surrounding agent</dfn></li>
29362936
<li><dfn data-x-href="https://tc39.es/ecma262/#sec-abstract-closure">abstract closure</dfn></li>
2937+
<li><dfn data-x-href="https://tc39.es/ecma262/#immutable-prototype-exotic-object">immutable prototype exotic object</dfn></li>
29372938
<li><dfn data-x-href="https://tc39.es/ecma262/#sec-well-known-symbols">Well-Known Symbols</dfn>, including
29382939
<dfn>@@hasInstance</dfn>,
29392940
<dfn>@@isConcatSpreadable</dfn>,
@@ -2945,6 +2946,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
29452946
<dfn>%EvalErrorPrototype%</dfn>,
29462947
<dfn data-x-href="https://tc39.es/ecma262/#sec-properties-of-the-function-prototype-object">%FunctionPrototype%</dfn>,
29472948
<dfn data-x-href="https://tc39.es/ecma262/#sec-json.parse">%JSONParse%</dfn>,
2949+
<dfn data-x-href="https://tc39.es/ecma262/#sec-properties-of-the-object-prototype-object">%ObjectPrototype%</dfn>,
29482950
<dfn data-x-href="https://tc39.es/ecma262/#sec-object.prototype.valueof">%ObjProto_valueOf%</dfn>,
29492951
<dfn>%RangeErrorPrototype%</dfn>,
29502952
<dfn>%ReferenceErrorPrototype%</dfn>,
@@ -8446,8 +8448,10 @@ interface <dfn>DOMStringList</dfn> {
84468448
</li>
84478449

84488450
<li>
8449-
<p>Otherwise, if <var>value</var> is an exotic object, then throw a
8450-
<span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p>
8451+
<p>Otherwise, if <var>value</var> is an exotic object and <var>value</var> is not the
8452+
<span>%ObjectPrototype%</span> intrinsic object associated with any <span>JavaScript
8453+
realm</span>, then throw a <span>"<code>DataCloneError</code>"</span>
8454+
<code>DOMException</code>.</p>
84518455

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

84628466
<li><p>Set <var>deep</var> to true.</p></li>
84638467
</ol>
8468+
8469+
<p class="note"><span>%ObjectPrototype%</span> will end up being handled via this step and
8470+
subsequent steps. The end result is that its exoticness is ignored, and after deserialization
8471+
the result will be an empty object (not an <span>immutable prototype exotic object</span>).
84648472
</li>
84658473

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

0 commit comments

Comments
 (0)