Skip to content

Commit

Permalink
lib: move web global bootstrapping to the expected file
Browse files Browse the repository at this point in the history
PR-URL: #47881
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Khaidi Chu <[email protected]>
  • Loading branch information
legendecas authored and RafaelGSS committed Jul 3, 2023
1 parent d623616 commit 562b3d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
13 changes: 1 addition & 12 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ const internalTimers = require('internal/timers');
const {
defineOperation,
deprecate,
defineLazyProperties,
} = require('internal/util');
const {
validateInteger,
Expand Down Expand Up @@ -208,22 +207,12 @@ internalBinding('async_wrap').setupHooks(nativeHooks);

const {
setupTaskQueue,
queueMicrotask,
} = require('internal/process/task_queues');

// Non-standard extensions:
defineOperation(globalThis, 'queueMicrotask', queueMicrotask);

const timers = require('timers');
// Non-standard extensions:
defineOperation(globalThis, 'clearImmediate', timers.clearImmediate);
defineOperation(globalThis, 'setImmediate', timers.setImmediate);

defineLazyProperties(
globalThis,
'internal/structured_clone',
['structuredClone'],
);

// Set the per-Environment callback that will be called
// when the TrackingTraceStateObserver updates trace state.
// Note that when NODE_USE_V8_PLATFORM is true, the observer is
Expand Down
13 changes: 12 additions & 1 deletion lib/internal/bootstrap/web/exposed-window-or-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,23 @@ defineOperation(globalThis, 'clearTimeout', timers.clearTimeout);
defineOperation(globalThis, 'setInterval', timers.setInterval);
defineOperation(globalThis, 'setTimeout', timers.setTimeout);

const {
queueMicrotask,
} = require('internal/process/task_queues');
defineOperation(globalThis, 'queueMicrotask', queueMicrotask);

defineLazyProperties(
globalThis,
'internal/structured_clone',
['structuredClone'],
);
defineLazyProperties(globalThis, 'buffer', ['atob', 'btoa']);

// https://html.spec.whatwg.org/multipage/web-messaging.html#broadcasting-to-other-browsing-contexts
exposeLazyInterfaces(globalThis, 'internal/worker/io', ['BroadcastChannel']);
exposeLazyInterfaces(globalThis, 'internal/worker/io', [
'MessageChannel', 'MessagePort', 'MessageEvent',
]);
defineLazyProperties(globalThis, 'buffer', ['atob', 'btoa']);
// https://www.w3.org/TR/FileAPI/#dfn-Blob
exposeLazyInterfaces(globalThis, 'internal/blob', ['Blob']);
// https://www.w3.org/TR/FileAPI/#dfn-file
Expand Down

0 comments on commit 562b3d4

Please sign in to comment.