node/tools
Joyee Cheung d98cfcc581
vm: introduce vanilla contexts via vm.constants.DONT_CONTEXTIFY
This implements a flavor of vm.createContext() and friends
that creates a context without contextifying its global object.
This is suitable when users want to freeze the context (impossible
when the global is contextified i.e. has interceptors installed)
or speed up the global access if they don't need the interceptor
behavior.

```js
const vm = require('node:vm');

const context = vm.createContext(vm.constants.DONT_CONTEXTIFY);

// In contexts with contextified global objects, this is false.
// In vanilla contexts this is true.
console.log(vm.runInContext('globalThis', context) === context);

// In contexts with contextified global objects, this would throw,
// but in vanilla contexts freezing the global object works.
vm.runInContext('Object.freeze(globalThis);', context);

// In contexts with contextified global objects, freezing throws
// and won't be effective. In vanilla contexts, freezing works
// and prevents scripts from accidentally leaking globals.
try {
  vm.runInContext('globalThis.foo = 1; foo;', context);
} catch(e) {
  console.log(e); // Uncaught ReferenceError: foo is not defined
}

console.log(context.Array);  // [Function: Array]
```

PR-URL: https://github.com/nodejs/node/pull/54394
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2024-08-29 09:05:03 +00:00
..
actions meta: use HTML entities in commit-queue comment 2024-07-08 16:29:43 +00:00
bootstrap doc: update boxstarter README 2024-07-21 22:23:31 +00:00
clang-format
configure.d
dep_updaters tools: make undici updater build wasm from src 2024-08-07 16:57:26 -04:00
doc vm: introduce vanilla contexts via vm.constants.DONT_CONTEXTIFY 2024-08-29 09:05:03 +00:00
eslint tools: update eslint to 9.8.0 2024-07-30 16:56:04 +02:00
eslint-rules tools: move ESLint to tools/eslint 2024-06-19 19:54:08 +00:00
github_reporter
gyp tools: update gyp-next to 0.18.1 2024-06-04 00:32:33 +00:00
icu deps: backport ICU-22787 to fix ClangCL on Windows 2024-08-27 18:44:05 +00:00
inspector_protocol
lint-md tools: update lint-md-dependencies 2024-07-16 00:33:17 +00:00
macos-installer
msvs tools: add find pyenv path on windows 2024-08-13 08:24:54 +00:00
pip
snapshot tools: replace reference to NodeMainInstance with SnapshotBuilder 2024-06-27 18:28:16 +00:00
v8
v8_gypfiles tools: update V8 gypfiles for 12.8 2024-08-16 16:05:31 +02:00
zos
build_addons.py node-api: add property keys benchmark 2024-07-29 11:19:52 +00:00
certdata.txt
checkimports.py
compress_json.py
copyfile.py
cpplint.py
create_android_makefiles
create_expfile.sh
enable_fips_include.py
executable_wrapper.h
find-inactive-collaborators.mjs tools: take co-authors into account in find-inactive-collaborators 2024-04-26 19:54:54 +00:00
find-inactive-tsc.mjs
gen_node_def.cc
generate_config_gypi.py tools: use v8_features.json to populate config.gypi 2024-07-15 23:47:00 +00:00
getmoduleversion.py
getnapibuildversion.py
getnodeversion.py
getsharedopensslhasquic.py
gyp_node.py
gypi_to_gn.py
install.py build: include v8-sandbox.h header in distribution 2024-08-16 16:04:18 +02:00
js2c.cc tools: update ESLint to v9 and use flat config 2024-05-23 19:45:18 +00:00
license2rtf.mjs
license-builder.sh tools: add swc license 2024-08-22 08:48:47 +00:00
lint-pr-url.mjs
lint-readme-lists.mjs tools: add workflow to ensure README lists are in sync with gh teams 2024-08-06 13:50:27 +00:00
lint-sh.mjs
lsan_suppressions.txt
macos-firewall.sh
make-v8.sh tools: remove no-goma arg from make-v8 script 2024-06-06 15:27:51 +00:00
merge-wpt-reports.mjs
mk-ca-bundle.pl
mkssldef.py
osx-codesign.sh
osx-entitlements.plist
osx-notarize.sh
osx-pkg-postinstall.sh
osx-productsign.sh
pseudo-tty.py
release.sh build, tools: drop leading / from r2dir 2024-07-22 13:21:35 +00:00
run-valgrind.py
run-worker.js
search_files.py
sign.bat
specialize_node_d.py
test-npm-package.js
test-v8.bat
test.py tools: fix skip detection of test runner output 2024-06-24 13:05:56 +00:00
update-timezone.mjs
utils.py
v8-json-to-junit.py
valgrind.supp