Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
131 lines (114 loc) · 2.92 KB

File metadata and controls

131 lines (114 loc) · 2.92 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
function printError(e) {
print(e.name);
print(e.number);
print(e.description);
}
var isMac = (WScript.Platform.OS === 'darwin');
var isWin = (WScript.Platform.OS === 'win32');
var expects = [
'#1', // 0
'In finally',
'Error: Out of stack space', // 2
'#2',
'In finally', // 4
'Error: Out of stack space',
'#3', // 6
'In finally',
'Error: Out of stack space' // 8
];
if (isWin) {
expects.push('testing stack overflow handling with catch block'); // 9
expects.push('Error: Out of stack space'); // 10
}
expects.push('testing stack overflow handling with finally block'); // 11
expects.push('Error: Out of stack space'); // 12
if (!isMac) // last test (sometimes) we hit timeout before we hit stackoverflow.
expects.push('Error: Out of stack space'); // 13
expects.push('END'); // 14
var index = 0;
function printLog(str) {
if (expects[index++] != str) {
WScript.Echo('At ' + (index - 1) + ' expected \n' + expects[index - 1] + '\nOutput:' + str);
WScript.Quit(1);
}
}
for (var i = 1; i < 4; i++) {
printLog("#" + i);
try {
try {
function f() {
f();
}
f();
} finally {
printLog("In finally");
}
}
catch (e) {
printLog(e);
}
}
if (isWin) { // xplat CI timeouts (it doesn't st. overflows as soon as Windows does)
printLog("testing stack overflow handling with catch block");
try {
function stackOverFlowCatch() {
try {
stackOverFlowCatch();
while (true) { }
}
catch (e) {
throw e;
}
}
stackOverFlowCatch();
}
catch (e) {
printLog(e);
}
}
printLog("testing stack overflow handling with finally block");
try
{
function stackOverFlowFinally() {
try {
stackOverFlowFinally();
while (true) {
}
}
finally {
DoSomething();
}
}
stackOverFlowFinally();
}
catch(e) {
printLog(e);
}
function DoSomething()
{
}
// 10K is not enough for our osx setup.
// for bigger numbers, we hit to timeout on CI (before we actually hit to S.O)
if (!isMac) {
try
{
var count = 100000;
var a = {};
var b = a;
for (var i = 0; i < count; i++)
{
a.x = {};
a = a.x;
}
eval("JSON.stringify(b)");
}
catch(e) {
printLog(e);
}
}
printLog('END'); // do not remove this
WScript.Echo("Pass");
Morty Proxy This is a proxified and sanitized view of the page, visit original site.