tor-browser

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

15.2.3.9-2-c-2.js (855B)


      1 // Copyright (c) 2012 Ecma International.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 es5id: 15.2.3.9-2-c-2
      6 description: >
      7    Object.freeze - The [[Configurable]] attribute of own accessor
      8    property of 'O' is set to false while other attributes are
      9    unchanged
     10 includes: [propertyHelper.js]
     11 ---*/
     12 
     13 var obj = {};
     14 
     15 function get_func() {
     16  return 10;
     17 }
     18 
     19 var set_funcCalled = false;
     20 
     21 function set_func() {
     22  set_funcCalled = true;
     23 }
     24 
     25 Object.defineProperty(obj, "foo", {
     26  get: get_func,
     27  set: set_func,
     28  enumerable: true,
     29  configurable: true
     30 });
     31 
     32 Object.freeze(obj);
     33 
     34 verifyProperty(obj, "foo", {
     35  configurable: false,
     36 });
     37 
     38 assert.sameValue(obj.foo, 10);
     39 
     40 obj.foo = 12;
     41 assert(set_funcCalled);
     42 
     43 verifyProperty(obj, "foo", {
     44  enumerable: true,
     45  configurable: false,
     46 });
     47 
     48 reportCompare(0, 0);