summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js
blob: aa7830df6754c19bcd8200ffe3110e3b6276f5f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
for (let ctor of typedArrayConstructors) {
  let arr = new ctor([1, 2, 3, 4, 5, 6, 7, 8]);

  arr.buffer.constructor = {
    get [Symbol.species]() {
      throw new Error("unexpected @@species access");
    }
  };

  for (let ctor2 of typedArrayConstructors) {
    let arr2 = new ctor2(arr);

    assertEq(Object.getPrototypeOf(arr2.buffer), ArrayBuffer.prototype);
    assertEq(arr2.buffer.constructor, ArrayBuffer);
  }
}

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