mirror of https://github.com/nodejs/node.git
bootstrap: --frozen-intrinsics unfreeze console
PR-URL: https://github.com/nodejs/node/pull/27663 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>pull/27777/head
parent
00ba75ed5e
commit
1a9a577a96
|
@ -211,11 +211,41 @@ Support is currently only provided for the root context and no guarantees are
|
||||||
currently provided that `global.Array` is indeed the default intrinsic
|
currently provided that `global.Array` is indeed the default intrinsic
|
||||||
reference.
|
reference.
|
||||||
|
|
||||||
**Code breakage is highly likely with this flag**, especially since limited
|
**Code breakage is highly likely with this flag**, since redefining any
|
||||||
support for subclassing builtins is provided currently due to ECMA-262 bug
|
builtin properties on a subclass will throw in strict mode due to the ECMA-262
|
||||||
https://github.com/tc39/ecma262/pull/1320.
|
issue https://github.com/tc39/ecma262/pull/1307. This flag may still change
|
||||||
|
or be removed in the future.
|
||||||
|
|
||||||
|
To avoid these cases, any builtin function overrides should be defined upfront:
|
||||||
|
|
||||||
|
<!-- eslint-disable no-redeclare -->
|
||||||
|
```js
|
||||||
|
const o = {};
|
||||||
|
// THROWS: Cannot assign read only property 'toString' of object
|
||||||
|
o.toString = () => 'string';
|
||||||
|
|
||||||
|
// OK
|
||||||
|
const o = { toString: () => 'string' };
|
||||||
|
|
||||||
|
class X {
|
||||||
|
constructor() {
|
||||||
|
this.toString = () => 'string';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// THROWS: Cannot assign read only property 'toString' of object
|
||||||
|
new X();
|
||||||
|
|
||||||
|
class X {
|
||||||
|
toString = undefined;
|
||||||
|
constructor() {
|
||||||
|
this.toString = () => 'string';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// OK
|
||||||
|
new X();
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
Both of the above may change in future updates, which will be breaking changes.
|
|
||||||
|
|
||||||
### `--heapsnapshot-signal=signal`
|
### `--heapsnapshot-signal=signal`
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
|
|
|
@ -32,7 +32,6 @@ module.exports = function() {
|
||||||
setInterval,
|
setInterval,
|
||||||
setTimeout
|
setTimeout
|
||||||
} = require('timers');
|
} = require('timers');
|
||||||
const console = require('internal/console/global');
|
|
||||||
|
|
||||||
const intrinsics = [
|
const intrinsics = [
|
||||||
// Anonymous Intrinsics
|
// Anonymous Intrinsics
|
||||||
|
@ -136,7 +135,6 @@ module.exports = function() {
|
||||||
setImmediate,
|
setImmediate,
|
||||||
setInterval,
|
setInterval,
|
||||||
setTimeout,
|
setTimeout,
|
||||||
console,
|
|
||||||
|
|
||||||
// Other APIs
|
// Other APIs
|
||||||
BigInt,
|
BigInt,
|
||||||
|
|
Loading…
Reference in New Issue