This repository was archived by the owner on Apr 16, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -211,11 +211,41 @@ Support is currently only provided for the root context and no guarantees are
211211currently provided that ` global.Array ` is indeed the default intrinsic
212212reference.
213213
214- ** Code breakage is highly likely with this flag** , especially since limited
215- support for subclassing builtins is provided currently due to ECMA-262 bug
216- https://github.com/tc39/ecma262/pull/1320 .
214+ ** Code breakage is highly likely with this flag** , since redefining any
215+ builtin properties on a subclass will throw in strict mode due to the ECMA-262
216+ issue https://github.com/tc39/ecma262/pull/1307 . This flag may still change
217+ or be removed in the future.
218+
219+ To avoid these cases, any builtin function overrides should be defined upfront:
220+
221+ <!-- eslint-disable no-redeclare -->
222+ ``` js
223+ const o = {};
224+ // THROWS: Cannot assign read only property 'toString' of object
225+ o .toString = () => ' string' ;
226+
227+ // OK
228+ const o = { toString : () => ' string' };
229+
230+ class X {
231+ constructor () {
232+ this .toString = () => ' string' ;
233+ }
234+ }
235+ // THROWS: Cannot assign read only property 'toString' of object
236+ new X ();
237+
238+ class X {
239+ toString = undefined ;
240+ constructor () {
241+ this .toString = () => ' string' ;
242+ }
243+ }
244+ // OK
245+ new X ();
246+ ```
247+
217248
218- Both of the above may change in future updates, which will be breaking changes.
219249
220250### ` --heapsnapshot-signal=signal `
221251<!-- YAML
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ module.exports = function() {
3232 setInterval,
3333 setTimeout
3434 } = require ( 'timers' ) ;
35- const console = require ( 'internal/console/global' ) ;
3635
3736 const intrinsics = [
3837 // Anonymous Intrinsics
@@ -136,7 +135,6 @@ module.exports = function() {
136135 setImmediate ,
137136 setInterval ,
138137 setTimeout ,
139- console ,
140138
141139 // Other APIs
142140 BigInt ,
You can’t perform that action at this time.
0 commit comments