Skip to content

Commit

Permalink
Consult .name instead of [[Prototype]] for Error serialization
Browse files Browse the repository at this point in the history
Fixes #5140.
  • Loading branch information
domenic authored Jan 7, 2020
1 parent 58dacb5 commit aeee879
Showing 1 changed file with 11 additions and 27 deletions.
38 changes: 11 additions & 27 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -8401,27 +8401,11 @@ interface <dfn>DOMStringList</dfn> {
too -->

<ol>
<li><p>Let <var>prototype</var> be "Error".</p></li>
<li><p>Let <var>name</var> be ? <span data-x="js-Get">Get</span>(<var>value</var>,
"name").</p></li>

<li><p>Let <var>valueProto</var> be ! <var>value</var>.[[GetPrototypeOf]]().</p></li>

<li><p>If <var>valueProto</var> is <span>%EvalErrorPrototype%</span>, then set
<var>prototype</var> to "EvalError".</p></li>

<li><p>If <var>valueProto</var> is <span>%RangeErrorPrototype%</span>, then set
<var>prototype</var> to "RangeError".</p></li>

<li><p>If <var>valueProto</var> is <span>%ReferenceErrorPrototype%</span>, then set
<var>prototype</var> to "ReferenceError".</p></li>

<li><p>If <var>valueProto</var> is <span>%SyntaxErrorPrototype%</span>, then set
<var>prototype</var> to "SyntaxError".</p></li>

<li><p>If <var>valueProto</var> is <span>%TypeErrorPrototype%</span>, then set
<var>prototype</var> to "TypeError".</p></li>

<li><p>If <var>valueProto</var> is <span>%URIErrorPrototype%</span>, then set
<var>prototype</var> to "URIError".</p></li>
<li><p>If <var>name</var> is not one of "Error", "EvalError", "RangeError", "ReferenceError",
"SyntaxError", "TypeError", or "URIError", then set <var>name</var> to "Error".</p></li>

<li><p>Let <var>valueMessageDesc</var> be ? <var>value</var>.[[GetOwnProperty]]("<code
data-x="">message</code>").</p></li>
Expand All @@ -8430,7 +8414,7 @@ interface <dfn>DOMStringList</dfn> {
<span>IsDataDescriptor</span>(<var>valueMessageDesc</var>) is false, and
? <span>ToString</span>(<var>valueMessageDesc</var>.[[Value]]) otherwise.</p></li>

<li><p>Set <var>serialized</var> to { [[Type]]: "Error", [[Prototype]]: <var>prototype</var>,
<li><p>Set <var>serialized</var> to { [[Type]]: "Error", [[Name]]: <var>name</var>,
[[Message]]: <var>message</var> }.</p></li>

<li>
Expand Down Expand Up @@ -8859,22 +8843,22 @@ o.myself = o;</code></pre>
<ol>
<li><p>Let <var>prototype</var> be <span>%ErrorPrototype%</span>.</p></li>

<li><p>If <var>serialized</var>.[[Prototype]] is "EvalError", then set <var>prototype</var> to
<li><p>If <var>serialized</var>.[[Name]] is "EvalError", then set <var>prototype</var> to
<span>%EvalErrorPrototype%</span>.</p></li>

<li><p>If <var>serialized</var>.[[Prototype]] is "RangeError", then set <var>prototype</var>
<li><p>If <var>serialized</var>.[[Name]] is "RangeError", then set <var>prototype</var>
to <span>%RangeErrorPrototype%</span>.</p></li>

<li><p>If <var>serialized</var>.[[Prototype]] is "ReferenceError", then set
<li><p>If <var>serialized</var>.[[Name]] is "ReferenceError", then set
<var>prototype</var> to <span>%ReferenceErrorPrototype%</span>.</p></li>

<li><p>If <var>serialized</var>.[[Prototype]] is "SyntaxError", then set <var>prototype</var>
<li><p>If <var>serialized</var>.[[Name]] is "SyntaxError", then set <var>prototype</var>
to <span>%SyntaxErrorPrototype%</span>.</p></li>

<li><p>If <var>serialized</var>.[[Prototype]] is "TypeError", then set <var>prototype</var> to
<li><p>If <var>serialized</var>.[[Name]] is "TypeError", then set <var>prototype</var> to
<span>%TypeErrorPrototype%</span>.</p></li>

<li><p>If <var>serialized</var>.[[Prototype]] is "URIError", then set <var>prototype</var> to
<li><p>If <var>serialized</var>.[[Name]] is "URIError", then set <var>prototype</var> to
<span>%URIErrorPrototype%</span>.</p></li>

<li><p>Let <var>message</var> be <var>serialized</var>.[[Message]].</p></li>
Expand Down

0 comments on commit aeee879

Please sign in to comment.