errors-other-realm.js (1120B)
1 // |reftest| skip-if(!Error.isError) -- Error.isError is not enabled unconditionally 2 // Copyright (C) 2024 Jordan Harband. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-error.iserror 7 description: > 8 Returns true on Error and Error subclass instances from a different realm 9 features: [Error.isError, cross-realm] 10 ---*/ 11 12 var other = $262.createRealm().global; 13 14 assert.sameValue(Error.isError(new other.Error()), true); 15 assert.sameValue(Error.isError(new other.EvalError()), true); 16 assert.sameValue(Error.isError(new other.RangeError()), true); 17 assert.sameValue(Error.isError(new other.ReferenceError()), true); 18 assert.sameValue(Error.isError(new other.SyntaxError()), true); 19 assert.sameValue(Error.isError(new other.TypeError()), true); 20 assert.sameValue(Error.isError(new other.URIError()), true); 21 22 if (typeof AggregateError !== 'undefined') { 23 assert.sameValue(Error.isError(new other.AggregateError([])), true); 24 } 25 if (typeof SuppressedError !== 'undefined') { 26 assert.sameValue(Error.isError(new other.SuppressedError()), true); 27 } 28 29 reportCompare(0, 0);