tor-browser

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

15.2.3.6-4-579.js (740B)


      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-579
      6 description: >
      7    ES5 Attributes - Success to add property into object (Array
      8    instance)
      9 ---*/
     10 
     11 var data = "data";
     12 
     13 Object.defineProperty(Array.prototype, "prop", {
     14  get: function() {
     15    return data;
     16  },
     17  set: function(value) {
     18    data = value;
     19  },
     20  enumerable: true,
     21  configurable: true
     22 });
     23 var arrObj = [];
     24 arrObj.prop = "myOwnProperty";
     25 
     26 assert.sameValue(arrObj.hasOwnProperty("prop"), false, 'arrObj.hasOwnProperty("prop")');
     27 assert.sameValue(arrObj.prop, "myOwnProperty", 'arrObj.prop');
     28 assert.sameValue(data, "myOwnProperty", 'data');
     29 
     30 reportCompare(0, 0);