Debian Codegraph @

js/src/tests/test262/harness/detachArrayBuffer.js

raw
1 // Copyright (C) 2017 Rick Waldron. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 description: >
5 Including detachArrayBuffer.js will expose a function:
6
7 $DETACHBUFFER
8
9 $DETACHBUFFER relies on the presence of a definition for $262.detachArrayBuffer.
10
11 Without a definition, calling $DETACHBUFFER will result in a ReferenceError
12 ---*/
13
14 var ab = new ArrayBuffer(1);
15 var threw = false;
16
17 try {
18 $DETACHBUFFER(ab);
19 } catch(err) {
20 threw = true;
21 if (err.constructor !== ReferenceError) {
22 throw new Error(
23 'Expected a ReferenceError, but a "' + err.constructor.name +
24 '" was thrown.'
25 );
26 }
27 }
28
29 if (threw === false) {
30 throw new Error('Expected a ReferenceError, but no error was thrown.');
31 }
32
33
34
35 reportCompare(0, 0);