@@ -1858,11 +1858,20 @@ GLOBAL.tests = {
1858
1858
'web.set-interval' : TIMERS ,
1859
1859
'web.set-timeout' : TIMERS ,
1860
1860
'web.structured-clone' : function ( ) {
1861
- var error = new Error ( ) ;
1862
- var test = structuredClone ( { a : error , b : error } ) ;
1863
- if ( ! ( test && test . a === test . b && test . a instanceof Error && test . stack === error . stack ) ) return false ;
1864
- test = structuredClone ( new AggregateError ( [ 1 ] , 'a' , { cause : 3 } ) ) ;
1865
- return test . name == 'AggregateError' && test . errors [ 0 ] == 1 && test . message == 'a' && test . cause == 3 ;
1861
+ function checkErrorsCloning ( structuredCloneImplementation , $Error ) {
1862
+ var error = new $Error ( ) ;
1863
+ var test = structuredCloneImplementation ( { a : error , b : error } ) ;
1864
+ return test && test . a === test . b && test . a instanceof $Error && test . a . stack === error . stack ;
1865
+ }
1866
+
1867
+ function checkNewErrorsCloningSemantic ( structuredCloneImplementation ) {
1868
+ var test = structuredCloneImplementation ( new AggregateError ( [ 1 ] , 'message' , { cause : 3 } ) ) ;
1869
+ return test . name == 'AggregateError' && test . errors [ 0 ] == 1 && test . message == 'message' && test . cause == 3 ;
1870
+ }
1871
+
1872
+ return checkErrorsCloning ( structuredClone , Error )
1873
+ && checkErrorsCloning ( structuredClone , DOMException )
1874
+ && checkNewErrorsCloningSemantic ( structuredClone ) ;
1866
1875
} ,
1867
1876
// TODO: Remove this module from `core-js@4` since it's split to submodules
1868
1877
'web.timers' : TIMERS ,
0 commit comments