summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/ArrayBuffer/prototype/detached/detached-buffer.js
blob: 33327abfffb4098a0d6081a4c1bd07917a289ce1 (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
// Copyright (C) 2023 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-arraybuffer.prototype.detached
description: Returns true if the buffer is detached, else false
info: |
  get ArrayBuffer.prototype.detached

  1. Let O be the this value.
  2. Perform ? RequireInternalSlot(O, [[ArrayBufferData]]).
  3. If IsSharedArrayBuffer(O) is true, throw a TypeError exception.
  4. Return IsDetachedBuffer(O).

includes: [detachArrayBuffer.js]
features: [ArrayBuffer, arraybuffer-transfer]
---*/

var ab = new ArrayBuffer(1);

assert.sameValue(ab.detached, false);

$DETACHBUFFER(ab);

assert.sameValue(ab.detached, true);

reportCompare(0, 0);