Skip to content

lib: expose performance interface to global object #29432

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

Closed
wants to merge 1 commit into from
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
4 changes: 4 additions & 0 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ if (!config.noBrowserGlobals) {
// https://encoding.spec.whatwg.org/#textdecoder
exposeInterface(global, 'TextDecoder', TextDecoder);

// https://w3c.github.io/performance-timeline/
const { performance } = require('perf_hooks');
exposeInterface(global, 'performance', performance);

// https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
const timers = require('timers');
defineOperation(global, 'clearInterval', timers.clearInterval);
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-bootstrap-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ const common = require('../common');
const assert = require('assert');

const expectedModules = new Set([
'Internal Binding errors',
'Internal Binding async_wrap',
'Internal Binding buffer',
'Internal Binding config',
'Internal Binding constants',
'Internal Binding contextify',
'Internal Binding credentials',
'Internal Binding errors',
'Internal Binding fs',
'Internal Binding inspector',
'Internal Binding module_wrap',
'Internal Binding native_module',
'Internal Binding options',
'Internal Binding performance',
'Internal Binding process_methods',
'Internal Binding string_decoder',
'Internal Binding task_queue',
Expand All @@ -29,6 +30,7 @@ const expectedModules = new Set([
'Internal Binding types',
'Internal Binding url',
'Internal Binding util',
'NativeModule async_hooks',
'NativeModule buffer',
'NativeModule events',
'NativeModule fs',
Expand Down Expand Up @@ -63,6 +65,7 @@ const expectedModules = new Set([
'NativeModule internal/util/types',
'NativeModule internal/validators',
'NativeModule path',
'NativeModule perf_hooks',
'NativeModule timers',
'NativeModule url',
'NativeModule vm',
Expand Down