mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65161 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com>
16 lines
564 B
JavaScript
16 lines
564 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const { validateByRetainingPath } = require('../common/heap');
|
|
const vm = require('vm');
|
|
const source = 'const foo = 123';
|
|
const script = new vm.Script(source);
|
|
const context = vm.createContext();
|
|
|
|
validateByRetainingPath('Node / ContextifyScript', [
|
|
{ node_name: 'system / SharedFunctionInfo' }, // This is the UnboundScript referenced by ContextifyScript.
|
|
{ edge_name: 'script' },
|
|
{ edge_name: 'source', node_type: 'string', node_name: source },
|
|
]);
|
|
|
|
console.log(script, context); // Keep the script and context alive.
|