Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-594.js

raw
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-594
6 description: >
7 ES5 Attributes - Success to update value of property into of
8 [[Proptotype]] internal property (Function.prototype.bind)
9 ---*/
10
11 var foo = function() {};
12 var data = "data";
13
14 Object.defineProperty(Function.prototype, "prop", {
15 get: function() {
16 return data;
17 },
18 set: function(value) {
19 data = value;
20 },
21 enumerable: true,
22 configurable: true
23 });
24
25 var obj = foo.bind({});
26 obj.prop = "overrideData";
27
28 assert.sameValue(obj.hasOwnProperty("prop"), false, 'obj.hasOwnProperty("prop")');
29 assert.sameValue(obj.prop, "overrideData", 'obj.prop');