tor-browser

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

object-seal-all-own-properties-of-o-are-already-non-configurable.js (1279B)


      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 - all own properties of 'O' are already
      8    non-configurable
      9 includes: [propertyHelper.js]
     10 ---*/
     11 
     12 var obj = {};
     13 obj.variableForHelpVerify = "data";
     14 
     15 Object.defineProperty(obj, "foo1", {
     16  value: 10,
     17  writable: true,
     18  enumerable: true,
     19  configurable: false
     20 });
     21 
     22 function set_func(value) {
     23  obj.variableForHelpVerify = value;
     24 }
     25 
     26 function get_func() {
     27  return 10;
     28 }
     29 Object.defineProperty(obj, "foo2", {
     30  get: get_func,
     31  set: set_func,
     32  enumerable: true,
     33  configurable: false
     34 });
     35 
     36 if (!Object.isExtensible(obj)) {
     37  throw new Test262Error('Expected obj to be extensible, actually ' + Object.isExtensible(obj));
     38 }
     39 
     40 Object.seal(obj);
     41 
     42 if (Object.isExtensible(obj)) {
     43  throw new Test262Error('Expected obj NOT to be extensible, actually ' + Object.isExtensible(obj));
     44 }
     45 
     46 verifyProperty(obj, "foo1", {
     47  value: 10,
     48  writable: true,
     49  enumerable: true,
     50  configurable: false,
     51 });
     52 
     53 verifyEqualTo(obj, "foo2", get_func());
     54 
     55 verifyWritable(obj, "foo2", "variableForHelpVerify");
     56 
     57 verifyProperty(obj, "foo2", {
     58  enumerable: true,
     59  configurable: false,
     60 });
     61 
     62 reportCompare(0, 0);