throws-when-false.js (593B)
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.preventextensions 6 description: > 7 Object.preventExtensions throws if O.[[PreventExtensions]]() returns false. 8 info: | 9 Object.preventExtensions ( O ) 10 ... 11 2. Let status be ? O.[[PreventExtensions]](). 12 3. If status is false, throw a TypeError exception. 13 ---*/ 14 15 const p = new Proxy({}, { 16 preventExtensions() { 17 return false; 18 }, 19 }); 20 21 assert.throws(TypeError, () => { 22 Object.preventExtensions(p); 23 }); 24 25 reportCompare(0, 0);