message-undefined-no-prop.js (1134B)
1 // |reftest| shell-option(--enable-explicit-resource-management) skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('explicit-resource-management'))||!xulRuntime.shell) -- explicit-resource-management is not enabled unconditionally, requires shell-options 2 // Copyright (C) 2023 Ron Buckton. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-suppressederror-constructor 7 description: > 8 If message is undefined, no property will be set to the new instance 9 info: | 10 SuppressedError ( error, suppressed, message ) 11 12 ... 13 5. If message is not undefined, then 14 a. Let msg be ? ToString(message). 15 b. Perform ! CreateMethodProperty(O, "message", msg). 16 6. Return O. 17 features: [explicit-resource-management] 18 ---*/ 19 20 var case1 = new SuppressedError(undefined, undefined, undefined); 21 22 assert.sameValue( 23 Object.prototype.hasOwnProperty.call(case1, 'message'), 24 false, 25 'explicit' 26 ); 27 28 var case2 = new SuppressedError([]); 29 30 assert.sameValue( 31 Object.prototype.hasOwnProperty.call(case2, 'message'), 32 false, 33 'implicit' 34 ); 35 36 reportCompare(0, 0);