Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 47dfe29

Browse filesBrowse files
committed
lib: replace eval with vm.runInThisContext
PR-URL: #18623 Refs: #18212 (review) Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent d1ff8fa commit 47dfe29
Copy full SHA for 47dfe29

File tree

Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-4
lines changed
Open diff view settings
Collapse file

‎lib/internal/v8_prof_processor.js‎

Copy file name to clipboardExpand all lines: lib/internal/v8_prof_processor.js
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
/* eslint-disable strict */
1+
'use strict';
2+
3+
const vm = require('vm');
4+
25
const scriptFiles = [
36
'internal/v8_prof_polyfill',
47
'v8/tools/splaytree',
@@ -30,9 +33,9 @@ if (process.platform === 'darwin') {
3033
tickArguments.push('--windows');
3134
}
3235
tickArguments.push.apply(tickArguments, process.argv.slice(1));
33-
script = `(function() {
36+
script = `(function(require) {
3437
arguments = ${JSON.stringify(tickArguments)};
3538
function write (s) { process.stdout.write(s) }
3639
${script}
37-
})()`;
38-
eval(script);
40+
})`;
41+
vm.runInThisContext(script)(require);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.