tor-browser

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

block-scoped-functions-annex-b-property.js (558B)


      1 // |reftest| skip-if(!xulRuntime.shell)
      2 
      3 // Define a global getter without a setter.
      4 Object.defineProperty(this, "x", {
      5  get: function () { return "get-x"; },
      6  configurable: true
      7 });
      8 
      9 // Simulate loading a 2nd script with evaluate, else we would DEFVAR the x and
     10 // the above defineProperty would fail in trying to redefine a non-configurable
     11 // property on the global.
     12 evaluate(`{
     13  function x() { return "fun-x"; }
     14 }`);
     15 
     16 // Annex B is supposed to be like an assignment. Should not blow away the
     17 // existing setter-less getter.
     18 reportCompare(x, "get-x");