summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArrayConstructors/ctors-bigint/buffer-arg/typedarray-backed-by-sharedarraybuffer.js
blob: d72633b53c1297755bc998b393b501864341bf90 (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
26
27
28
// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-typedarray-typedarray
description: >
  Passing a SharedArrayBuffer-backed TypedArray to a TypedArray constructor
  produces an ArrayBuffer-backed TypedArray.
includes: [testBigIntTypedArray.js]
features: [BigInt, SharedArrayBuffer, TypedArray]
---*/

var sab = new SharedArrayBuffer(8);

testWithBigIntTypedArrayConstructors(function(View1) {
  var ta1 = new View1(sab);
  testWithBigIntTypedArrayConstructors(function(View2) {
    var ta2 = new View2(ta1);
    assert.sameValue(
      ta2.buffer.constructor,
      ArrayBuffer,
      "TypedArray of SharedArrayBuffer-backed TypedArray is ArrayBuffer-backed"
    );
  });
});

reportCompare(0, 0);