From 34d70ce615109e12f231e730040ac554b2349da7 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 25 Jan 2023 21:06:55 +0100 Subject: [PATCH] vm: expose cachedDataRejected for vm.compileFunction Having this information available is useful for functions just as it is for scripts. Therefore, expose it in the same way that other information related to code caching is reported. As part of this, de-duplify the code for setting the properties on the C++ side and add proper exception handling to it. PR-URL: https://github.com/nodejs/node/pull/46320 Reviewed-By: Gus Caplan Reviewed-By: Chengzhong Wu --- doc/api/vm.md | 6 ++ lib/internal/vm.js | 4 ++ src/node_contextify.cc | 125 ++++++++++++++++++++------------- src/node_contextify.h | 8 +++ test/parallel/test-vm-basic.js | 26 +++++-- 5 files changed, 114 insertions(+), 55 deletions(-) diff --git a/doc/api/vm.md b/doc/api/vm.md index 35a5d4f4bafd67..10c1cbefee828c 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -962,6 +962,12 @@ const vm = require('node:vm');