aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMyles Borins <mylesborins@google.com>2018-02-07 10:42:26 -0500
committerRuben Bridgewater <ruben@bridgewater.de>2018-02-17 14:35:34 +0100
commit99d693da5c1b753d15fb7c744de0c4cb87098c93 (patch)
treed66ed6e781be07892b738bbd2c83b603fc47296d /lib
parent38f04d4da179dd3610ee07c2441601cdb2436a6a (diff)
downloadandroid-node-v8-99d693da5c1b753d15fb7c744de0c4cb87098c93.tar.gz
android-node-v8-99d693da5c1b753d15fb7c744de0c4cb87098c93.tar.bz2
android-node-v8-99d693da5c1b753d15fb7c744de0c4cb87098c93.zip
lib: replace `eval` with `vm.runInThisContext`
PR-URL: https://github.com/nodejs/node/pull/18623 Refs: https://github.com/nodejs/node/pull/18212#pullrequestreview-94616927 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>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/v8_prof_processor.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/internal/v8_prof_processor.js b/lib/internal/v8_prof_processor.js
index 9c63430f96..0d9cfd6df4 100644
--- a/lib/internal/v8_prof_processor.js
+++ b/lib/internal/v8_prof_processor.js
@@ -1,4 +1,7 @@
-/* eslint-disable strict */
+'use strict';
+
+const vm = require('vm');
+
const scriptFiles = [
'internal/v8_prof_polyfill',
'internal/deps/v8/tools/splaytree',
@@ -31,9 +34,9 @@ if (process.platform === 'darwin') {
tickArguments.push('--windows');
}
tickArguments.push.apply(tickArguments, process.argv.slice(1));
-script = `(function() {
+script = `(function(require) {
arguments = ${JSON.stringify(tickArguments)};
function write (s) { process.stdout.write(s) }
${script}
-})()`;
-eval(script);
+})`;
+vm.runInThisContext(script)(require);