summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/self-hosting/object-define-hazard.js
blob: 7a1ccc224363a0fcae754b5aad46364c3974497a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// We shouldn't do the wrong thing in the face of an evil Object.prototype

Object.prototype.get = function() {};
var x = {};
var setter = function () {};
x.__defineSetter__("a", setter);
var desc = Object.getOwnPropertyDescriptor(x, "a");
assertEq(desc.get, undefined);
assertEq(desc.set, setter);
delete Object.prototype.get;

Object.prototype.set = function() {};
x = {};
var getter = function () {};
x.__defineGetter__("a", getter);
desc = Object.getOwnPropertyDescriptor(x, "a");
assertEq(desc.set, undefined);
assertEq(desc.get, getter);