instance-extensibility.js (1201B)
1 // |reftest| shell-option(--enable-shadow-realms) skip-if(!xulRuntime.shell) -- requires shell-options 2 // Copyright (C) 2021 Leo Balter. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-shadowrealm 7 description: > 8 The new instance is extensible 9 info: | 10 ShadowRealm ( ) 11 12 ... 13 2. Let O be ? OrdinaryCreateFromConstructor(NewTarget, "%ShadowRealm.prototype%", 14 « [[ShadowRealm]], [[ExecutionContext]] »). 15 ... 16 13. Return O. 17 18 OrdinaryCreateFromConstructor creates a new ordinary objects including the 19 internal slots [[Prototype]] and [[Extensible]]. The latter will have its 20 value set to true. 21 includes: [propertyHelper.js] 22 features: [ShadowRealm] 23 ---*/ 24 25 const realm = new ShadowRealm(); 26 27 assert(Object.isExtensible(realm)); 28 29 Object.defineProperty(realm, 'foo', { configurable: true }); 30 assert(realm.hasOwnProperty('foo'), 'confirms extensibility adding a new property'); 31 32 Object.defineProperty(realm, 'foo', { 33 value: 'bar', 34 writable: true, 35 configurable: true, 36 enumerable: false, 37 }); 38 39 verifyProperty(realm, 'foo', { 40 value: 'bar', 41 writable: true, 42 configurable: true, 43 enumerable: false, 44 }); 45 46 reportCompare(0, 0);