tor-browser

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

15.2.3.5-4-274.js (968B)


      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.5-4-274
      6 description: >
      7    Object.create - 'set' property of one property in 'Properties' is
      8    own accessor property that overrides an inherited data property
      9    (8.10.5 step 8.a)
     10 ---*/
     11 
     12 var data1 = "data";
     13 var data2 = "data";
     14 
     15 var proto = {};
     16 proto.set = function(value) {
     17  data2 = value;
     18 };
     19 
     20 var ConstructFun = function() {};
     21 ConstructFun.prototype = proto;
     22 var child = new ConstructFun();
     23 Object.defineProperty(child, "set", {
     24  get: function() {
     25    return function(value) {
     26      data1 = value;
     27    };
     28  }
     29 });
     30 
     31 var newObj = Object.create({}, {
     32  prop: child
     33 });
     34 
     35 var hasProperty = newObj.hasOwnProperty("prop");
     36 
     37 newObj.prop = "overrideData";
     38 
     39 assert(hasProperty, 'hasProperty !== true');
     40 assert.sameValue(data1, "overrideData", 'data1');
     41 assert.sameValue(data2, "data", 'data2');
     42 
     43 reportCompare(0, 0);