From 110ead9abb6351bc9fffac1ed2cca99728e0477c 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 09081fad2240bf..481aded758150b 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -962,6 +962,12 @@ const vm = require('node:vm');