aboutsummaryrefslogtreecommitdiffstats
path: root/src/annex-b-fns/eval-global-existing-global-init.case
blob: 02d9aa778959d92c5cfb5496e54ab8f28ce25e50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
desc: Variable binding is set to `undefined`
template: eval-global
info: |
    B.3.3.3 Changes to EvalDeclarationInstantiation

    [...]
    i. If varEnvRec is a global Environment Record, then
       i. Perform ? varEnvRec.CreateGlobalFunctionBinding(F, undefined, true).
    [...]

    8.1.1.4.18 CreateGlobalFunctionBinding

    [...]
    5. If existingProp is undefined or existingProp.[[Configurable]] is true,
       then
       [...]
    6. Else,
       a. Let desc be the PropertyDescriptor{[[Value]]: V }.
    [...]
includes: [fnGlobalObject.js, propertyHelper.js]
---*/

//- setup
Object.defineProperty(fnGlobalObject(), 'f', {
  value: 'x',
  enumerable: true,
  writable: true,
  configurable: false
});
//- before
var global = fnGlobalObject();
assert.sameValue(f, undefined, "binding is initialized to `undefined`");

verifyProperty(global, "f", {
  enumerable: true,
  writable: true,
  configurable: false
});