Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap: unfreeze console under --frozen-intrinsics #27663

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
reference.

**Code breakage is highly likely with this flag**, especially since limited
support for subclassing builtins is provided currently due to ECMA-262 bug
https:/tc39/ecma262/pull/1320.
**Code breakage is highly likely with this flag**, since redefining any
builtin properties on a subclass will throw in strict mode due to the ECMA-262
issue https:/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`
<!-- YAML
Expand Down
2 changes: 0 additions & 2 deletions lib/internal/freeze_intrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module.exports = function() {
setInterval,
setTimeout
} = require('timers');
const console = require('internal/console/global');

const intrinsics = [
// Anonymous Intrinsics
Expand Down Expand Up @@ -136,7 +135,6 @@ module.exports = function() {
setImmediate,
setInterval,
setTimeout,
console,

// Other APIs
BigInt,
Expand Down