@@ -23,6 +23,7 @@ const {
2323 TypedArrayPrototypeGetSymbolToStringTag,
2424 TypedArrayPrototypeGetByteLength,
2525 Uint8Array,
26+ AggregateError,
2627} = primordials ;
2728
2829const { compare } = internalBinding ( 'buffer' ) ;
@@ -235,9 +236,23 @@ function innerDeepEqual(val1, val2, strict, memos) {
235236 } else if ( isNativeError ( val1 ) || val1 instanceof Error ) {
236237 // Do not compare the stack as it might differ even though the error itself
237238 // is otherwise identical.
238- if ( ( ! isNativeError ( val2 ) && ! ( val2 instanceof Error ) ) ||
239- val1 . message !== val2 . message ||
240- val1 . name !== val2 . name ) {
239+ if ( ! isNativeError ( val2 ) && ! ( val2 instanceof Error ) ) {
240+ return false ;
241+ }
242+
243+ const message1Enumerable = ObjectPrototypePropertyIsEnumerable ( val1 , 'message' ) ;
244+ const name1Enumerable = ObjectPrototypePropertyIsEnumerable ( val1 , 'name' ) ;
245+ const cause1Enumerable = ObjectPrototypePropertyIsEnumerable ( val1 , 'cause' ) ;
246+ const errors1Enumerable = ObjectPrototypePropertyIsEnumerable ( val1 , 'errors' ) ;
247+
248+ if ( ( message1Enumerable !== ObjectPrototypePropertyIsEnumerable ( val2 , 'message' ) ||
249+ ( ! message1Enumerable && val1 . message !== val2 . message ) ) ||
250+ ( name1Enumerable !== ObjectPrototypePropertyIsEnumerable ( val2 , 'name' ) ||
251+ ( ! name1Enumerable && val1 . name !== val2 . name ) ) ||
252+ ( cause1Enumerable !== ObjectPrototypePropertyIsEnumerable ( val2 , 'cause' ) ||
253+ ( ! cause1Enumerable && ! innerDeepEqual ( val1 . cause , val2 . cause , strict , memos ) ) ) ||
254+ ( errors1Enumerable !== ObjectPrototypePropertyIsEnumerable ( val2 , 'errors' ) ||
255+ ( ! errors1Enumerable && ! innerDeepEqual ( val1 . errors , val2 . errors , strict , memos ) ) ) ) {
241256 return false ;
242257 }
243258 } else if ( isBoxedPrimitive ( val1 ) ) {
0 commit comments