|
1 | 1 | // Basic tests for a form of stack recursion that's been shown to cause C++ |
2 | 2 | // side stack overflows in the past. See SERVER-19614. |
3 | 3 |
|
4 | | -// TODO: Re-enable this test once SERVER-19614 has been resolved in a |
5 | | -// way that does not conflict with SERVER-20678. See the similar |
6 | | -// comment in src/mongo/scripting/mozjs/implscope.cpp for additional |
7 | | -// details. |
8 | | -// |
9 | | -// (function () { |
10 | | -// "use strict"; |
11 | | -// |
12 | | -// db.recursion.drop(); |
13 | | -// |
14 | | -// // Make sure the shell doesn't blow up |
15 | | -// function shellRecursion() { |
16 | | -// shellRecursion.apply(); |
17 | | -// } |
18 | | -// assert.throws(shellRecursion); |
19 | | -// |
20 | | -// // Make sure db.eval doesn't blow up |
21 | | -// function dbEvalRecursion() { |
22 | | -// db.eval(function () { |
23 | | -// function recursion() { |
24 | | -// recursion.apply(); |
25 | | -// } |
26 | | -// recursion(); |
27 | | -// }); |
28 | | -// } |
29 | | -// assert.commandFailedWithCode(assert.throws(dbEvalRecursion), ErrorCodes.JSInterpreterFailure); |
30 | | -// |
31 | | -// // Make sure mapReduce doesn't blow up |
32 | | -// function mapReduceRecursion() { |
33 | | -// db.recursion.mapReduce(function(){ |
34 | | -// (function recursion(){ |
35 | | -// recursion.apply(); |
36 | | -// })(); |
37 | | -// }, function(){ |
38 | | -// }, { |
39 | | -// out: 'inline' |
40 | | -// }); |
41 | | -// } |
42 | | -// |
43 | | -// db.recursion.insert({}); |
44 | | -// assert.commandFailedWithCode( |
45 | | -// assert.throws(mapReduceRecursion), ErrorCodes.JSInterpreterFailure); |
46 | | -// }()); |
| 4 | +(function () { |
| 5 | + "use strict"; |
| 6 | + |
| 7 | + db.recursion.drop(); |
| 8 | + |
| 9 | + // Make sure the shell doesn't blow up |
| 10 | + function shellRecursion() { |
| 11 | + shellRecursion.apply(); |
| 12 | + } |
| 13 | + assert.throws(shellRecursion); |
| 14 | + |
| 15 | + // Make sure db.eval doesn't blow up |
| 16 | + function dbEvalRecursion() { |
| 17 | + db.eval(function () { |
| 18 | + function recursion() { |
| 19 | + recursion.apply(); |
| 20 | + } |
| 21 | + recursion(); |
| 22 | + }); |
| 23 | + } |
| 24 | + assert.commandFailedWithCode(assert.throws(dbEvalRecursion), ErrorCodes.JSInterpreterFailure); |
| 25 | + |
| 26 | + // Make sure mapReduce doesn't blow up |
| 27 | + function mapReduceRecursion() { |
| 28 | + db.recursion.mapReduce(function(){ |
| 29 | + (function recursion(){ |
| 30 | + recursion.apply(); |
| 31 | + })(); |
| 32 | + }, function(){ |
| 33 | + }, { |
| 34 | + out: 'inline' |
| 35 | + }); |
| 36 | + } |
| 37 | + |
| 38 | + db.recursion.insert({}); |
| 39 | + assert.commandFailedWithCode( |
| 40 | + assert.throws(mapReduceRecursion), ErrorCodes.JSInterpreterFailure); |
| 41 | +}()); |
0 commit comments