From aeee8796d8cb3edbd943e953df2df04092a146fb Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 7 Jan 2020 12:28:40 -0500 Subject: [PATCH] Consult .name instead of [[Prototype]] for Error serialization Fixes #5140. --- source | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/source b/source index f8270f388b5..723fbd4c0ea 100644 --- a/source +++ b/source @@ -8401,27 +8401,11 @@ interface DOMStringList { too -->
    -
  1. Let prototype be "Error".

  2. +
  3. Let name be ? Get(value, + "name").

  4. -
  5. Let valueProto be ! value.[[GetPrototypeOf]]().

  6. - -
  7. If valueProto is %EvalErrorPrototype%, then set - prototype to "EvalError".

  8. - -
  9. If valueProto is %RangeErrorPrototype%, then set - prototype to "RangeError".

  10. - -
  11. If valueProto is %ReferenceErrorPrototype%, then set - prototype to "ReferenceError".

  12. - -
  13. If valueProto is %SyntaxErrorPrototype%, then set - prototype to "SyntaxError".

  14. - -
  15. If valueProto is %TypeErrorPrototype%, then set - prototype to "TypeError".

  16. - -
  17. If valueProto is %URIErrorPrototype%, then set - prototype to "URIError".

  18. +
  19. If name is not one of "Error", "EvalError", "RangeError", "ReferenceError", + "SyntaxError", "TypeError", or "URIError", then set name to "Error".

  20. Let valueMessageDesc be ? value.[[GetOwnProperty]]("message").

  21. @@ -8430,7 +8414,7 @@ interface DOMStringList { IsDataDescriptor(valueMessageDesc) is false, and ? ToString(valueMessageDesc.[[Value]]) otherwise.

    -
  22. Set serialized to { [[Type]]: "Error", [[Prototype]]: prototype, +

  23. Set serialized to { [[Type]]: "Error", [[Name]]: name, [[Message]]: message }.

  24. @@ -8859,22 +8843,22 @@ o.myself = o;
    1. Let prototype be %ErrorPrototype%.

    2. -
    3. If serialized.[[Prototype]] is "EvalError", then set prototype to +

    4. If serialized.[[Name]] is "EvalError", then set prototype to %EvalErrorPrototype%.

    5. -
    6. If serialized.[[Prototype]] is "RangeError", then set prototype +

    7. If serialized.[[Name]] is "RangeError", then set prototype to %RangeErrorPrototype%.

    8. -
    9. If serialized.[[Prototype]] is "ReferenceError", then set +

    10. If serialized.[[Name]] is "ReferenceError", then set prototype to %ReferenceErrorPrototype%.

    11. -
    12. If serialized.[[Prototype]] is "SyntaxError", then set prototype +

    13. If serialized.[[Name]] is "SyntaxError", then set prototype to %SyntaxErrorPrototype%.

    14. -
    15. If serialized.[[Prototype]] is "TypeError", then set prototype to +

    16. If serialized.[[Name]] is "TypeError", then set prototype to %TypeErrorPrototype%.

    17. -
    18. If serialized.[[Prototype]] is "URIError", then set prototype to +

    19. If serialized.[[Name]] is "URIError", then set prototype to %URIErrorPrototype%.

    20. Let message be serialized.[[Message]].