unscopables-prop-get-err.js (1152B)
1 // Copyright 2015 Mike Pennisi. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-getidentifierreference 6 es6id: 8.1.2.1 7 description: > 8 Behavior when accessing property of `Symbol.unscopables` property throws an 9 error 10 info: | 11 [...] 12 2. Let envRec be lex's EnvironmentRecord. 13 3. Let exists be ? envRec.HasBinding(name). 14 15 8.1.1.2.1 HasBinding 16 17 [...] 18 5. If the withEnvironment flag of envRec is false, return true. 19 6. Let unscopables be ? Get(bindings, @@unscopables). 20 7. If Type(unscopables) is Object, then 21 a. Let blocked be ToBoolean(? Get(unscopables, N)). 22 b. If blocked is true, return false. 23 24 13.11.7 (The `with` Statement) Runtime Semantics: Evaluation 25 26 [...] 27 5. Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. 28 [...] 29 flags: [noStrict] 30 features: [Symbol.unscopables] 31 ---*/ 32 33 var env = { x: 86 }; 34 env[Symbol.unscopables] = {}; 35 36 Object.defineProperty(env[Symbol.unscopables], 'x', { 37 get: function() { 38 throw new Test262Error(); 39 } 40 }); 41 42 with (env) { 43 assert.throws(Test262Error, function() { 44 x; 45 }); 46 } 47 48 reportCompare(0, 0);