summaryrefslogtreecommitdiff
path: root/js/src/jit-test/tests/jaeger/propertyOptimize-4.js
blob: 942474875a143ee556562aa93e0a48f4a446f572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Make sure new script properties can be invalidated on specialized prototype
// types while they are still being constructed.

function Foo(a, b, c) {
  this.x = a + b;
  this.y = c;
}

updated = false;
var o = {valueOf: function() {
    Object.defineProperty(Object.prototype, 'y', {set:function() { updated = true; }})
  }};

function Bar() {}
Bar.prototype = new Foo(o, 1, 2);
assertEq(updated, true);
assertEq(Bar.prototype.y, undefined);