-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy patharguments.js
50 lines (36 loc) · 1.39 KB
/
arguments.js
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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var x = foo(1, 2, 3);
var y = fooDeleted(1, 2, 3);
function foo(a, b, c)
{
var res = {};
var args = arguments;
res.length = function() { return args.length; };
res.named = function() { return b; };
res.position = function() { return args[1]; };
return res;
}
function fooDeleted(a, b, c)
{
delete arguments[1];
var res = {};
var args = arguments;
res.length = function() { return args.length; };
res.named = function() { return b; };
res.position = function() { return args[1]; };
return res;
}
WScript.SetTimeout(testFunction, 20);
function testFunction()
{
telemetryLog(`xlength: ${x.length()}`, true); //3
telemetryLog(`xnamed: ${x.named()}`, true); //2
telemetryLog(`xposition: ${x.position()}`, true); //2
telemetryLog(`ylength: ${y.length()}`, true); //3
telemetryLog(`ynamed: ${y.named()}`, true); //2
telemetryLog(`yposition: ${y.position()}`, true); //undefined
emitTTDLog(ttdLogURI);
}