This is so we can inform V8 about a known limit for the stack. Otherwise, on some systems recursive functions may lead to segmentation faults rather than “safe” failures. PR-URL: https://github.com/nodejs/node/pull/26049 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
12 lines
379 B
JavaScript
12 lines
379 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { Worker } = require('worker_threads');
|
|
|
|
const worker = new Worker('function f() { f(); } f();', { eval: true });
|
|
|
|
worker.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.constructor, RangeError);
|
|
assert.strictEqual(err.message, 'Maximum call stack size exceeded');
|
|
}));
|