diff --git a/source b/source index cf487e9120d..b13c0964e93 100644 --- a/source +++ b/source @@ -2764,19 +2764,15 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute @@isConcatSpreadable, @@toPrimitive, and @@toStringTag +
User agents that support JavaScript must also implement the Error Cause + proposal. The following terms are defined there, and used in this specification:
+ +The following terms are defined in the JSON modules proposal and used in this specification:
@@ -2908,6 +2912,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attributeWebAssembly.Module
Let name be ? Get(value, "name").
If name is not one of "Error", "EvalError", "RangeError", "ReferenceError", - "SyntaxError", "TypeError", or "URIError", then set name to "Error".
If name is neither "AggregateError", nor one of the + NativeError names, nor one of the WebAssembly Error class + names, then set name to "Error".
Let message be ? StructuredSerializeInternal(? Get(value, "message"), forStorage, + memory).
Let cause be ? StructuredSerializeInternal(? Get(value, "cause"), forStorage, + memory).
Let valueMessageDesc be ? value.[[GetOwnProperty]]("message
").
Let errors be undefined.
Let message be undefined if - IsDataDescriptor(valueMessageDesc) is false, and - ? ToString(valueMessageDesc.[[Value]]) otherwise.
If name is "AggregateError", then set errors to ? + StructuredSerializeInternal(? Get(value, + "errors"), forStorage, memory).
Set serialized to { [[Type]]: "Error", [[Name]]: name, - [[Message]]: message }.
User agents should attach a serialized representation of any interesting accompanying
- data which are not yet specified, notably the stack
property, to
+
User agents should attach a serialized representation of any interesting accompanying data
+ which are not yet specified, notably the stack
property, to
serialized.
See the Error Stacks proposal for in-progress work on - specifying this data.
+See the Error Stacks proposal for in-progress work on specifying + this data.
If ! HasOwnProperty(value, key) is true, then:
Let inputValue be ? value.[[Get]](key, - value).
Let inputValue be ? Get(value, + key).
Let outputValue be ? StructuredSerializeInternal(inputValue, forStorage, @@ -8737,38 +8751,41 @@ o.myself = o;
Otherwise, if serialized.[[Type]] is "Error", then:
Let prototype be %Error.prototype%.
If serialized.[[Name]] is "EvalError", then set prototype to - %EvalError.prototype%.
Let name be serialized.[[Name]].
If serialized.[[Name]] is "RangeError", then set prototype - to %RangeError.prototype%.
Let prototype be + targetRealm.[[Intrinsics]].[[%name%.prototype]], or the equivalent if + name is a WebAssembly Error class name.
If serialized.[[Name]] is "ReferenceError", then set - prototype to %ReferenceError.prototype%.
Set value to ! ObjectCreate(prototype, « + [[ErrorData]] »).
If serialized.[[Name]] is "SyntaxError", then set prototype - to %SyntaxError.prototype%.
Let message be ? + StructuredDeserialize(serialized.[[Message]], targetRealm, + memory).
If serialized.[[Name]] is "TypeError", then set prototype to - %TypeError.prototype%.
Perform ! CreateNonEnumerableDataPropertyOrThrow(value, + "message", message).
If serialized.[[Name]] is "URIError", then set prototype to - %URIError.prototype%.
Let cause be ? + StructuredDeserialize(serialized.[[Cause]], targetRealm, + memory).
Let message be serialized.[[Message]].
Perform ! CreateNonEnumerableDataPropertyOrThrow(value, "cause", + cause).
Set value to ! ObjectCreate(prototype, « - [[ErrorData]] »).
If name is "AggregateError", then:
-Let messageDesc be PropertyDescriptor{ [[Value]]: - message, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true - }.
Let errors be ? + StructuredDeserialize(serialized.[[Errors]], targetRealm, + memory).
If message is not undefined, then perform !
- OrdinaryDefineOwnProperty(value, "message
",
- messageDesc).
Perform ! CreateNonEnumerableDataPropertyOrThrow(value, + "errors", errors).
Any interesting accompanying data attached to serialized should be deserialized and attached to value.