Skip to content

Commit 414f01b

Browse files
committed
1 parent b1bc880 commit 414f01b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/app/src/sandbox/eval/transpilers/babel/worker/plugins/babel-plugin-transform-prevent-infinite-loops.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ module.exports = ({ types: t, template }) => {
1515
// We set a global so that we can later fail the test
1616
// even if the error ends up being caught by the code.
1717
const buildGuard = template(`
18+
if (ITERATOR++ > MAX_ITERATIONS) {
1819
var csb_global = typeof window === 'undefined' ? self : window;
19-
if (ITERATOR++ > MAX_ITERATIONS) {
20-
csb_global.infiniteLoopError = new RangeError(
21-
'Potential infinite loop: exceeded ' +
22-
MAX_ITERATIONS +
23-
' iterations. You can disable this check by creating a sandbox.config.json file.'
24-
);
25-
throw csb_global.infiniteLoopError;
26-
}
20+
csb_global.infiniteLoopError = new RangeError(
21+
'Potential infinite loop: exceeded ' +
22+
MAX_ITERATIONS +
23+
' iterations. You can disable this check by creating a sandbox.config.json file.'
24+
);
25+
throw csb_global.infiniteLoopError;
26+
}
2727
`);
2828

2929
return {

0 commit comments

Comments
 (0)