mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
ESM merge to main (#227184)
Co-authored-by: Johannes Rieken <jrieken@microsoft.com> Co-authored-by: Alexandru Dima <alexdima@microsoft.com>
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
// come before any mocha imports.
|
||||
process.env.MOCHA_COLORS = '1';
|
||||
|
||||
const { app, BrowserWindow, ipcMain, crashReporter } = require('electron');
|
||||
const { app, BrowserWindow, ipcMain, crashReporter, session } = require('electron');
|
||||
const product = require('../../../product.json');
|
||||
const { tmpdir } = require('os');
|
||||
const { existsSync, mkdirSync } = require('fs');
|
||||
@@ -218,6 +218,12 @@ class IPCRunner extends events.EventEmitter {
|
||||
|
||||
app.on('ready', () => {
|
||||
|
||||
// needed when loading resources from the renderer, e.g xterm.js or the encoding lib
|
||||
session.defaultSession.protocol.registerFileProtocol('vscode-file', (request, callback) => {
|
||||
const path = new URL(request.url).pathname;
|
||||
callback({ path });
|
||||
});
|
||||
|
||||
ipcMain.on('error', (_, err) => {
|
||||
if (!args.dev) {
|
||||
console.error(err);
|
||||
@@ -249,7 +255,7 @@ app.on('ready', () => {
|
||||
width: 800,
|
||||
show: false,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js'),
|
||||
preload: path.join(__dirname, 'preload.js'), // ensure similar environment as VSCode as tests may depend on this
|
||||
additionalArguments: [`--vscode-window-config=vscode:test-vscode-window-config`],
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
@@ -302,7 +308,9 @@ app.on('ready', () => {
|
||||
win.webContents.send('run', args);
|
||||
}
|
||||
|
||||
win.loadURL(url.format({ pathname: path.join(__dirname, 'renderer.html'), protocol: 'file:', slashes: true }));
|
||||
const target = url.pathToFileURL(path.join(__dirname, 'renderer.html'));
|
||||
target.searchParams.set('argv', JSON.stringify(args));
|
||||
win.loadURL(target.href);
|
||||
|
||||
const runner = new IPCRunner(win);
|
||||
createStatsCollector(runner);
|
||||
|
||||
Reference in New Issue
Block a user