mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
cbee12c701
These values are all non-enumerable and will never be checked. By removing them, we make sure they will not become enumerable unnoticed. PR-URL: https://github.com/nodejs/node/pull/20717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
35 lines
856 B
JavaScript
35 lines
856 B
JavaScript
'use strict';
|
|
// Copy console accessor because requiring ../common touches it
|
|
const consoleDescriptor = Object.getOwnPropertyDescriptor(global, 'console');
|
|
Object.defineProperty(global, 'console', {
|
|
configurable: true,
|
|
writable: true,
|
|
value: {}
|
|
});
|
|
|
|
require('../common');
|
|
|
|
// This test checks that, if Node cannot put together the `console` object
|
|
// because it is low on stack space while doing so, it can succeed later
|
|
// once the stack has unwound a little, and `console` is in a usable state then.
|
|
|
|
let compiledConsole;
|
|
|
|
function a() {
|
|
try {
|
|
return a();
|
|
} catch (e) {
|
|
compiledConsole = consoleDescriptor.value;
|
|
if (compiledConsole.log) {
|
|
// Using `console.log` itself might not succeed yet, but the code for it
|
|
// has been compiled.
|
|
} else {
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
|
|
a();
|
|
|
|
compiledConsole.log('Hello, World!');
|