summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Array/concat-proxy.js
blob: ab733e2f10d1ea5997f2145903ddafe2df72939c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var BUGNUMBER = 1287520;
var summary = 'Array.prototype.concat should check HasProperty everytime for non-dense array';

print(BUGNUMBER + ": " + summary);

var a = [1, 2, 3];
a.constructor = {
  [Symbol.species]: function(...args) {
    var p = new Proxy(new Array(...args), {
      defineProperty(target, propertyKey, receiver) {
        if (propertyKey === "0") delete a[1];
        return Reflect.defineProperty(target, propertyKey, receiver);
      }
    });
    return p;
  }
};

var p = a.concat();
assertEq(0 in p, true);
assertEq(1 in p, false);
assertEq(2 in p, true);

if (typeof reportCompare === "function")
  reportCompare(true, true);