throws-when-false.js (682B)
1 // Copyright (C) 2019 Ecma International. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-object.freeze 6 description: > 7 Object.freeze throws if SetIntegrityLevel(O, frozen) returns false. 8 info: | 9 Object.freeze ( O ) 10 ... 11 2. Let status be ? SetIntegrityLevel(O, frozen). 12 3. If status is false, throw a TypeError exception. 13 14 SetIntegrityLevel ( O, level ) 15 ... 16 3. Let status be ? O.[[PreventExtensions]](). 17 4. If status is false, return false. 18 ---*/ 19 20 const p = new Proxy({}, { 21 preventExtensions() { 22 return false; 23 }, 24 }); 25 26 assert.throws(TypeError, () => { 27 Object.freeze(p); 28 }); 29 30 reportCompare(0, 0);