File tree 2 files changed +34
-6
lines changed
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
211
211
currently provided that ` global.Array ` is indeed the default intrinsic
212
212
reference.
213
213
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
+
217
248
218
- Both of the above may change in future updates, which will be breaking changes.
219
249
220
250
### ` --heapsnapshot-signal=signal `
221
251
<!-- YAML
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ module.exports = function() {
32
32
setInterval,
33
33
setTimeout
34
34
} = require ( 'timers' ) ;
35
- const console = require ( 'internal/console/global' ) ;
36
35
37
36
const intrinsics = [
38
37
// Anonymous Intrinsics
@@ -136,7 +135,6 @@ module.exports = function() {
136
135
setImmediate ,
137
136
setInterval ,
138
137
setTimeout ,
139
- console ,
140
138
141
139
// Other APIs
142
140
BigInt ,
You can’t perform that action at this time.
0 commit comments