forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharraybuffer.js
More file actions
56 lines (45 loc) · 1.7 KB
/
arraybuffer.js
File metadata and controls
56 lines (45 loc) · 1.7 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
WScript.Echo("new ArrayBuffer without argument");
var a = new ArrayBuffer();
WScript.Echo(a.byteLength);
a.byteLength = 999;
WScript.Echo(a.byteLength);
WScript.Echo("new ArrayBuffer with ulong argument");
var b = new ArrayBuffer(8);
WScript.Echo(b.byteLength);
b.byteLength = 999;
WScript.Echo(b.byteLength);
WScript.Echo("new ArrayBuffer with multiple arguments");
var c = new ArrayBuffer(9, 10, 11);
WScript.Echo(c.byteLength);
c.byteLength = 999;
WScript.Echo(c.byteLength);
WScript.Echo("new ArrayBuffer with string argument");
var d = new ArrayBuffer('20');
WScript.Echo(d.byteLength);
d.byteLength = 999;
WScript.Echo(d.byteLength);
WScript.Echo("new ArrayBuffer with invalid string argument");
var e = new ArrayBuffer('hello');
WScript.Echo(e.byteLength);
e.byteLength = 999;
WScript.Echo(e.byteLength);
WScript.Echo(e.toString());
WScript.Echo("a instanceof ArrayBuffer" + a instanceof ArrayBuffer);
for (i in d) {
WScript.Echo(i);
}
WScript.Echo("arraybuffer.prototype")
var f = Object.getPrototypeOf(e);
var g = new f.constructor(20);
WScript.Echo(g)
WScript.Echo(g.byteLength);
WScript.Echo(typeof f);
WScript.Echo(ArrayBuffer.prototype[10]);
WScript.Echo(ArrayBuffer.prototype[-1]);
WScript.Echo(ArrayBuffer.prototype[2]);
ArrayBuffer.prototype[2] = 10;
WScript.Echo(ArrayBuffer.prototype[2]);