![electron-roller[bot]](/assets/img/avatar_default.png)
* chore: bump node in DEPS to v22.16.0 * crypto: remove BoringSSL dh-primes addition https://github.com/nodejs/node/pull/57023 * tools: enable linter in test/fixtures/test\-runner/output https://github.com/nodejs/node/pull/57698 * src: improve thread safety of TaskQueue https://github.com/nodejs/node/pull/57910 * buffer: define global v8::CFunction objects as const https://github.com/nodejs/node/pull/57676 * src: disable abseil deadlock detection https://github.com/nodejs/node/pull/57582 * zlib: fix pointer alignment https://github.com/nodejs/node/pull/57727 * chore: fixup patch indices * src: set default config as node.config.json https://github.com/nodejs/node/pull/57171 * src: update std::vector<v8::Local<T>> to use v8::LocalVector<T> https://github.com/nodejs/node/pull/57578 * test: disable chmod tests failing in Docker https://github.com/nodejs/node/issues/58326 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
40 lines
1.9 KiB
Diff
40 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
Date: Sun, 27 Mar 2016 14:42:26 +0900
|
|
Subject: Pass all globals through "require"
|
|
|
|
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
|
|
|
|
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
|
|
index ccd2b4ced3134d81ddd37b8b5b90218457633421..a19fc5e52109bf2ad63fbe554c02a458c3096081 100644
|
|
--- a/lib/internal/modules/cjs/loader.js
|
|
+++ b/lib/internal/modules/cjs/loader.js
|
|
@@ -200,6 +200,13 @@ const {
|
|
CHAR_FORWARD_SLASH,
|
|
} = require('internal/constants');
|
|
|
|
+// Store the "global" variable from global scope into a local scope, so we can
|
|
+// still reference it from this file even after we deleted the "global" variable
|
|
+// from the global scope.
|
|
+const localGlobal = (typeof global !== 'undefined') ? global : undefined;
|
|
+// Do the same for "Buffer".
|
|
+const localBuffer = (typeof Buffer !== 'undefined') ? Buffer : undefined;
|
|
+
|
|
const {
|
|
isProxy,
|
|
} = require('internal/util/types');
|
|
@@ -1725,10 +1732,12 @@ Module.prototype._compile = function(content, filename, format) {
|
|
if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) {
|
|
const { callAndPauseOnStart } = internalBinding('inspector');
|
|
result = callAndPauseOnStart(compiledWrapper, thisValue, exports,
|
|
- require, module, filename, dirname);
|
|
+ require, module, filename, dirname,
|
|
+ process, localGlobal, localBuffer);
|
|
} else {
|
|
result = ReflectApply(compiledWrapper, thisValue,
|
|
- [exports, require, module, filename, dirname]);
|
|
+ [exports, require, module, filename, dirname,
|
|
+ process, localGlobal, localBuffer]);
|
|
}
|
|
this[kIsExecuting] = false;
|
|
if (requireDepth === 0) { statCache = null; }
|