tor-browser

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

configurable-attribute-all-own-properties-set-from-true-to-false-property-are-unaltered.js (1235B)


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