tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

global-block-decl-eval-global-existing-non-enumerable-global-init.js (1343B)


      1 // This file was procedurally generated from the following sources:
      2 // - src/annex-b-fns/eval-global-existing-non-enumerable-global-init.case
      3 // - src/annex-b-fns/eval-global/direct-block.template
      4 /*---
      5 description: Variable binding is left in place by legacy function hoisting. CreateGlobalVariableBinding leaves the binding as non-enumerable even if it has the chance to change it to be enumerable. (Block statement in eval code containing a function declaration)
      6 esid: sec-web-compat-evaldeclarationinstantiation
      7 flags: [generated, noStrict]
      8 includes: [fnGlobalObject.js, propertyHelper.js]
      9 info: |
     10    B.3.3.3 Changes to EvalDeclarationInstantiation
     11 
     12    [...]
     13    i. If varEnvRec is a global Environment Record, then
     14       i. Perform ? varEnvRec.CreateGlobalVarBinding(F, true).
     15    [...]
     16 
     17 ---*/
     18 Object.defineProperty(fnGlobalObject(), 'f', {
     19  value: 'x',
     20  enumerable: false,
     21  writable: true,
     22  configurable: true
     23 });
     24 
     25 eval(
     26  'var global = fnGlobalObject();\
     27  assert.sameValue(f, "x", "binding is not reinitialized");\
     28  \
     29  verifyProperty(global, "f", {\
     30    enumerable: false,\
     31    writable: true,\
     32    configurable: true\
     33  }, { restore: true });{ function f() {  } }'
     34 );
     35 
     36 assert.sameValue(typeof f, "function");
     37 verifyProperty(global, 'f', {
     38  enumerable: false,
     39  writable: true,
     40  configurable: true
     41 });
     42 
     43 reportCompare(0, 0);