mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
* chore: bump node in DEPS to v24.13.1 * chore: fixup patches refs: * https://github.com/nodejs/node/pull/60425 * https://github.com/nodejs/node/pull/61270 * https://github.com/nodejs/node/pull/61044 * fix: generate_config_gypi needs to generate valid JSON https://github.com/nodejs/node/pull/60794 * doc: align Buffer.concat documentation with behavior https://github.com/nodejs/node/pull/60405 * src: fix off-thread cert loading in bundled cert mode https://github.com/nodejs/node/pull/60764 * build: fix extraneous includes --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
41 lines
1.9 KiB
Diff
41 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 2b199e82fee3a9d56521b9c5cc04a20cdfd6f045..e28755a20176c2806769430910b28a0e61d7691e 100644
|
|
--- a/lib/internal/modules/cjs/loader.js
|
|
+++ b/lib/internal/modules/cjs/loader.js
|
|
@@ -209,6 +209,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');
|
|
@@ -1799,10 +1806,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; }
|