blob: af48263ff6419d3d628e1eec2b87701b64e91478 (
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
29
30
31
32
|
// Copyright (C) 2022 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
Creating TypedArray from other TypedArrays doesn't look up Symbol.species.
features: [TypedArray, ArrayBuffer, Symbol.species]
---*/
let throwOnGrossBufferConstruction = false;
class GrossBuffer extends ArrayBuffer {
constructor() {
super(...arguments);
if (throwOnGrossBufferConstruction) {
throw new Test262Error("unreachable");
}
}
static get [Symbol.species]() {
throw new Test262Error("unreachable");
}
}
let grossBuf = new GrossBuffer(1024);
throwOnGrossBufferConstruction = true;
let grossTA = new Uint8Array(grossBuf);
let mysteryTA = new Int8Array(grossTA);
assert.sameValue(mysteryTA.buffer.__proto__, ArrayBuffer.prototype);
assert.sameValue(mysteryTA.buffer.constructor, ArrayBuffer);
reportCompare(0, 0);
|