forked from chakra-core/ChakraCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionName.js
More file actions
43 lines (34 loc) · 1.01 KB
/
FunctionName.js
File metadata and controls
43 lines (34 loc) · 1.01 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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
//
// Test function names showed in stack trace.
//
function Dump(output) {
if (this.WScript) {
WScript.Echo(output);
} else {
alert(output);
}
}
if (this.WScript && this.WScript.LoadScriptFile) {
this.WScript.LoadScriptFile("TrimStackTracePath.js");
}
try {
var foo = function() {
throw new Error("My Error!");
};
function func(){
foo();
}
var constructed = new Function("func();");
function bar(){
(function(){
eval("constructed();");
})();
}
bar();
} catch(e) {
Dump(TrimStackTracePath(e.stack));
}