tor-browser

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

object-seal-p-is-own-data-property-that-overrides-an-inherited-accessor-property.js (751B)


      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 esid: sec-setintegritylevel
      6 description: >
      7    Object.seal - 'P' is own data property that overrides an inherited
      8    accessor property
      9 includes: [propertyHelper.js]
     10 ---*/
     11 
     12 var proto = {};
     13 
     14 Object.defineProperty(proto, "foo", {
     15  get: function() {
     16    return 0;
     17  },
     18  configurable: true
     19 });
     20 
     21 var ConstructFun = function() {};
     22 ConstructFun.prototype = proto;
     23 
     24 var obj = new ConstructFun();
     25 Object.defineProperty(obj, "foo", {
     26  value: 10,
     27  configurable: true
     28 });
     29 
     30 assert(Object.isExtensible(obj));
     31 Object.seal(obj);
     32 
     33 verifyProperty(obj, "foo", {
     34  value: 10,
     35  configurable: false,
     36 });
     37 
     38 reportCompare(0, 0);