From f4706251981fb6321a0a760d12523791a26b5867 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 b45588b557d9ac..ad243faaaf5e85 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -964,6 +964,12 @@ const vm = require('node:vm');