-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy patheval.js
35 lines (25 loc) · 1.25 KB
/
eval.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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
var evalCode1;
eval("evalCode1 = function() { return evalCode1 + ' ' + captured; }");
var evalCode2 = undefined;
var evalCode3 = undefined;
var captured = "ok";
function setCode2()
{
var notCaptured = 5;
var captured = "bob in setCode2";
eval("evalCode2 = function() { return evalCode2 + ' ' + captured; }");
eval.call(this, "evalCode3 = function() { return evalCode3 + ' ' + captured; }")
}
setCode2();
WScript.SetTimeout(testFunction, 50);
function testFunction()
{
telemetryLog(`evalCode1: ${evalCode1()}`, true); //function () { return evalCode1 + ' ' + captured; } ok"
telemetryLog(`evalCode2: ${evalCode2()}`, true); //function () { return evalCode2 + ' ' + captured; } bob in setCode2"
telemetryLog(`evalCode3: ${evalCode3()}`, true); //function () { return evalCode3 + ' ' + captured; } ok"
emitTTDLog(ttdLogURI);
}