@@ -52,7 +52,7 @@ const {
52
52
globalThis,
53
53
} = primordials ;
54
54
const config = internalBinding ( 'config' ) ;
55
- const { deprecate, lazyDOMExceptionClass } = require ( 'internal/util' ) ;
55
+ const { deprecate } = require ( 'internal/util' ) ;
56
56
57
57
setupProcessObject ( ) ;
58
58
@@ -184,82 +184,7 @@ if (credentials.implementsPosixCredentials) {
184
184
const { nativeHooks } = require ( 'internal/async_hooks' ) ;
185
185
internalBinding ( 'async_wrap' ) . setupHooks ( nativeHooks ) ;
186
186
187
- const {
188
- setupTaskQueue,
189
- queueMicrotask
190
- } = require ( 'internal/process/task_queues' ) ;
191
-
192
- if ( ! config . noBrowserGlobals ) {
193
- // Override global console from the one provided by the VM
194
- // to the one implemented by Node.js
195
- // https://console.spec.whatwg.org/#console-namespace
196
- exposeNamespace ( globalThis , 'console' ,
197
- createGlobalConsole ( globalThis . console ) ) ;
198
-
199
- const { URL , URLSearchParams } = require ( 'internal/url' ) ;
200
- // https://url.spec.whatwg.org/#url
201
- exposeInterface ( globalThis , 'URL' , URL ) ;
202
- // https://url.spec.whatwg.org/#urlsearchparams
203
- exposeInterface ( globalThis , 'URLSearchParams' , URLSearchParams ) ;
204
- exposeGetterAndSetter ( globalThis ,
205
- 'DOMException' ,
206
- lazyDOMExceptionClass ,
207
- ( value ) => {
208
- exposeInterface ( globalThis , 'DOMException' , value ) ;
209
- } ) ;
210
-
211
- const {
212
- TextEncoder, TextDecoder
213
- } = require ( 'internal/encoding' ) ;
214
- // https://encoding.spec.whatwg.org/#textencoder
215
- exposeInterface ( globalThis , 'TextEncoder' , TextEncoder ) ;
216
- // https://encoding.spec.whatwg.org/#textdecoder
217
- exposeInterface ( globalThis , 'TextDecoder' , TextDecoder ) ;
218
-
219
- const {
220
- AbortController,
221
- AbortSignal,
222
- } = require ( 'internal/abort_controller' ) ;
223
- exposeInterface ( globalThis , 'AbortController' , AbortController ) ;
224
- exposeInterface ( globalThis , 'AbortSignal' , AbortSignal ) ;
225
-
226
- const {
227
- EventTarget,
228
- Event,
229
- } = require ( 'internal/event_target' ) ;
230
- exposeInterface ( globalThis , 'EventTarget' , EventTarget ) ;
231
- exposeInterface ( globalThis , 'Event' , Event ) ;
232
- const {
233
- MessageChannel,
234
- MessagePort,
235
- MessageEvent,
236
- } = require ( 'internal/worker/io' ) ;
237
- exposeInterface ( globalThis , 'MessageChannel' , MessageChannel ) ;
238
- exposeInterface ( globalThis , 'MessagePort' , MessagePort ) ;
239
- exposeInterface ( globalThis , 'MessageEvent' , MessageEvent ) ;
240
-
241
- // https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
242
- const timers = require ( 'timers' ) ;
243
- defineOperation ( globalThis , 'clearInterval' , timers . clearInterval ) ;
244
- defineOperation ( globalThis , 'clearTimeout' , timers . clearTimeout ) ;
245
- defineOperation ( globalThis , 'setInterval' , timers . setInterval ) ;
246
- defineOperation ( globalThis , 'setTimeout' , timers . setTimeout ) ;
247
-
248
- defineOperation ( globalThis , 'queueMicrotask' , queueMicrotask ) ;
249
-
250
- // https://www.w3.org/TR/hr-time-2/#the-performance-attribute
251
- defineReplacableAttribute ( globalThis , 'performance' ,
252
- require ( 'perf_hooks' ) . performance ) ;
253
-
254
- // Non-standard extensions:
255
- defineOperation ( globalThis , 'clearImmediate' , timers . clearImmediate ) ;
256
- defineOperation ( globalThis , 'setImmediate' , timers . setImmediate ) ;
257
-
258
- const {
259
- structuredClone,
260
- } = require ( 'internal/structured_clone' ) ;
261
- defineOperation ( globalThis , 'structuredClone' , structuredClone ) ;
262
- }
187
+ const { setupTaskQueue } = require ( 'internal/process/task_queues' ) ;
263
188
264
189
// Set the per-Environment callback that will be called
265
190
// when the TrackingTraceStateObserver updates trace state.
@@ -456,69 +381,3 @@ function setupBuffer() {
456
381
} ,
457
382
} ) ;
458
383
}
459
-
460
- function createGlobalConsole ( consoleFromVM ) {
461
- const consoleFromNode =
462
- require ( 'internal/console/global' ) ;
463
- if ( config . hasInspector ) {
464
- const inspector = require ( 'internal/util/inspector' ) ;
465
- // This will be exposed by `require('inspector').console` later.
466
- inspector . consoleFromVM = consoleFromVM ;
467
- // TODO(joyeecheung): postpone this until the first time inspector
468
- // is activated.
469
- inspector . wrapConsole ( consoleFromNode , consoleFromVM ) ;
470
- const { setConsoleExtensionInstaller } = internalBinding ( 'inspector' ) ;
471
- // Setup inspector command line API.
472
- setConsoleExtensionInstaller ( inspector . installConsoleExtensions ) ;
473
- }
474
- return consoleFromNode ;
475
- }
476
-
477
- // https://heycam.github.io/webidl/#es-namespaces
478
- function exposeNamespace ( target , name , namespaceObject ) {
479
- ObjectDefineProperty ( target , name , {
480
- writable : true ,
481
- enumerable : false ,
482
- configurable : true ,
483
- value : namespaceObject
484
- } ) ;
485
- }
486
-
487
- // https://heycam.github.io/webidl/#es-interfaces
488
- function exposeInterface ( target , name , interfaceObject ) {
489
- ObjectDefineProperty ( target , name , {
490
- writable : true ,
491
- enumerable : false ,
492
- configurable : true ,
493
- value : interfaceObject
494
- } ) ;
495
- }
496
-
497
- function exposeGetterAndSetter ( target , name , getter , setter = undefined ) {
498
- ObjectDefineProperty ( target , name , {
499
- enumerable : false ,
500
- configurable : true ,
501
- get : getter ,
502
- set : setter ,
503
- } ) ;
504
- }
505
-
506
- // https://heycam.github.io/webidl/#define-the-operations
507
- function defineOperation ( target , name , method ) {
508
- ObjectDefineProperty ( target , name , {
509
- writable : true ,
510
- enumerable : true ,
511
- configurable : true ,
512
- value : method
513
- } ) ;
514
- }
515
-
516
- // https://heycam.github.io/webidl/#Replaceable
517
- function defineReplacableAttribute ( target , name , value ) {
518
- ObjectDefineProperty ( target , name , {
519
- writable : true ,
520
- enumerable : true ,
521
- configurable : true ,
522
- value,
523
- } ) ;
524
- }
0 commit comments