tor-browser

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

15.2.3.6-4-540-8.js (1586B)


      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.6-4-540-8
      6 description: >
      7    Object.defineProperty fails to update [[Get]] and [[Set]]
      8    attributes of an indexed accessor property 'P' whose
      9    [[Configurable]] attribute is false, 'O' is an Arguments object
     10    (8.12.9 step 11.a)
     11 includes: [propertyHelper.js]
     12 ---*/
     13 
     14 var obj = (function() {
     15  return arguments;
     16 }());
     17 
     18 obj.verifySetFunction = "data";
     19 var getFunc = function() {
     20  return obj.verifySetFunction;
     21 };
     22 var setFunc = function(value) {
     23  obj.verifySetFunction = value;
     24 };
     25 Object.defineProperty(obj, "0", {
     26  get: getFunc,
     27  set: setFunc,
     28  configurable: false
     29 });
     30 
     31 var result = false;
     32 try {
     33  Object.defineProperty(obj, "0", {
     34    get: function() {
     35      return 100;
     36    }
     37  });
     38 } catch (e) {
     39  result = e instanceof TypeError;
     40  verifyEqualTo(obj, "0", getFunc());
     41 
     42  verifyWritable(obj, "0", "verifySetFunction");
     43 }
     44 
     45 verifyProperty(obj, "0", {
     46  enumerable: false,
     47  configurable: false,
     48 });
     49 
     50 try {
     51  Object.defineProperty(obj, "0", {
     52    set: function(value) {
     53      obj.verifySetFunction1 = value;
     54    }
     55  });
     56 } catch (e) {
     57  if (!result) {
     58    throw new Test262Error('Expected result  to be true, actually ' + result);
     59  }
     60 
     61  verifyEqualTo(obj, "0", getFunc());
     62 
     63  verifyWritable(obj, "0", "verifySetFunction");
     64 
     65  if (!(e instanceof TypeError)) {
     66    throw new Test262Error("Expected TypeError, got " + e);
     67  }
     68 }
     69 
     70 verifyProperty(obj, "0", {
     71  enumerable: false,
     72  configurable: false,
     73 });
     74 
     75 reportCompare(0, 0);