summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/lexical-environment/block-scoped-functions-annex-b-property.js
blob: a295de5081bbf3b0919d67791f781e7766176c5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// |reftest| skip-if(!xulRuntime.shell)

// Define a global getter without a setter.
Object.defineProperty(this, "x", {
  get: function () { return "get-x"; },
  configurable: true
});

// Simulate loading a 2nd script with evaluate, else we would DEFVAR the x and
// the above defineProperty would fail in trying to redefine a non-configurable
// property on the global.
evaluate(`{
  function x() { return "fun-x"; }
}`);

// Annex B is supposed to be like an assignment. Should not blow away the
// existing setter-less getter.
reportCompare(x, "get-x");