Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Object/defineProperty/15.2.3.6-4-418.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-418
6 description: >
7 ES5 Attributes - Successfully add a property to an object when the
8 object's prototype has a property with the same name and
9 [[Writable]] set to true (Function.prototype.bind)
10 ---*/
11
12 var foo = function() {};
13
14 Object.defineProperty(Function.prototype, "prop", {
15 value: 1001,
16 writable: true,
17 enumerable: true,
18 configurable: true
19 });
20
21 var obj = foo.bind({});
22 obj.prop = 1002;
23
24 assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true');
25 assert.sameValue(obj.prop, 1002, 'obj.prop');