forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransferdetach.js
More file actions
30 lines (23 loc) · 891 Bytes
/
transferdetach.js
File metadata and controls
30 lines (23 loc) · 891 Bytes
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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
if (this.WScript && this.WScript.LoadScriptFile) { // Check for running in ch
this.WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");
}
var a = new ArrayBuffer(0x10);
function foo() {
detach(a);
return 6;
};
function detach(ab) {
var c = ArrayBuffer.transfer(a, 0x10);
};
var obj = {
valueOf: foo
};
function test() {
ArrayBuffer.transfer(a, obj);
}
assert.throws(test, TypeError, "", "ArrayBuffer.transfer: The ArrayBuffer is detached.");
print("pass");