Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Pasero <benjpas@microsoft.com>2021-08-04 11:45:11 +0300
committerGitHub <noreply@github.com>2021-08-04 11:45:11 +0300
commitb6ca3e52ae62b64f7e30009bed4402a0235a4e92 (patch)
tree333c30cb34d3d054cf84bd9db4e84e883f93ff2e /src/bootstrap-window.js
parent53c3a2297bf33474d79e584c292d7068ece02800 (diff)
Remove dependency on node require for startup code path (#130088)
* sandbox - disable support to enable file protocol * mitigate symlinks on different drives
Diffstat (limited to 'src/bootstrap-window.js')
-rw-r--r--src/bootstrap-window.js26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/bootstrap-window.js b/src/bootstrap-window.js
index 0dbdbc5265d..0cc92ec15a3 100644
--- a/src/bootstrap-window.js
+++ b/src/bootstrap-window.js
@@ -24,7 +24,6 @@
const bootstrapLib = bootstrap();
const preloadGlobals = sandboxGlobals();
const safeProcess = preloadGlobals.process;
- const useCustomProtocol = safeProcess.sandboxed || typeof safeProcess.env['VSCODE_BROWSER_CODE_LOADING'] === 'string';
/**
* @typedef {import('./vs/base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
@@ -83,8 +82,10 @@
developerDeveloperKeybindingsDisposable = registerDeveloperKeybindings(disallowReloadKeybinding);
}
- // Enable ASAR support
- globalThis.MonacoBootstrap.enableASARSupport(configuration.appRoot, true);
+ // Enable ASAR support (TODO@sandbox non-sandboxed only)
+ if (!safeProcess.sandboxed) {
+ globalThis.MonacoBootstrap.enableASARSupport(configuration.appRoot);
+ }
// Get the nls configuration into the process.env as early as possible
const nlsConfig = globalThis.MonacoBootstrap.setupNLS();
@@ -98,11 +99,6 @@
window.document.documentElement.setAttribute('lang', locale);
- // Do not advertise AMD to avoid confusing UMD modules loaded with nodejs
- if (!useCustomProtocol) {
- window['define'] = undefined;
- }
-
// Replace the patched electron fs with the original node fs for all AMD code (TODO@sandbox non-sandboxed only)
if (!safeProcess.sandboxed) {
require.define('fs', [], function () { return require.__$__nodeRequire('original-fs'); });
@@ -111,11 +107,9 @@
window['MonacoEnvironment'] = {};
const loaderConfig = {
- baseUrl: useCustomProtocol ?
- `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out` :
- `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32' })}/out`,
+ baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out`,
'vs/nls': nlsConfig,
- preferScriptTags: useCustomProtocol
+ preferScriptTags: true
};
// use a trusted types policy when loading via script tags
@@ -149,14 +143,6 @@
loaderConfig.amdModulesPattern = /^vs\//;
}
- // Cached data config (node.js loading only)
- if (!useCustomProtocol && configuration.codeCachePath) {
- loaderConfig.nodeCachedData = {
- path: configuration.codeCachePath,
- seed: modulePaths.join('')
- };
- }
-
// Signal before require.config()
if (typeof options?.beforeLoaderConfig === 'function') {
options.beforeLoaderConfig(loaderConfig);