mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 05:51:32 +01:00
sandbox - further reduce electron dependencies
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./media/issueReporter';
|
||||
import { clipboard, shell } from 'electron';
|
||||
import { ipcRenderer, webFrame } from 'vs/base/electron-sandbox/globals';
|
||||
import { clipboard } from 'electron';
|
||||
import { ipcRenderer, webFrame } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import * as os from 'os';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
import { $ } from 'vs/base/browser/dom';
|
||||
import { $, windowOpenNoOpener } from 'vs/base/browser/dom';
|
||||
import { Button } from 'vs/base/browser/ui/button/button';
|
||||
import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded
|
||||
import { CodiconLabel } from 'vs/base/browser/ui/codicons/codiconLabel';
|
||||
@@ -463,7 +463,7 @@ export class IssueReporter extends Disposable {
|
||||
|
||||
this.addEventListener('extensionBugsLink', 'click', (e: Event) => {
|
||||
const url = (<HTMLElement>e.target).innerText;
|
||||
shell.openExternal(url);
|
||||
windowOpenNoOpener(url);
|
||||
});
|
||||
|
||||
this.addEventListener('disableExtensions', 'keydown', (e: Event) => {
|
||||
@@ -1195,7 +1195,7 @@ export class IssueReporter extends Disposable {
|
||||
event.stopPropagation();
|
||||
// Exclude right click
|
||||
if (event.which < 3) {
|
||||
shell.openExternal((<HTMLAnchorElement>event.target).href);
|
||||
windowOpenNoOpener((<HTMLAnchorElement>event.target).href);
|
||||
this.telemetryService.publicLog2('issueReporterViewSimilarIssue');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
// @ts-check
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
const { ipcRenderer, webFrame } = require('electron');
|
||||
|
||||
// @ts-ignore
|
||||
window.vscode = {
|
||||
|
||||
/**
|
||||
* A minimal set of methods exposed from ipcRenderer
|
||||
* to support communication to electron-main
|
||||
*
|
||||
* @type {typeof import('../../base/electron-sandbox/globals').ipcRenderer}
|
||||
*/
|
||||
ipcRenderer: {
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {any[]} args
|
||||
*/
|
||||
send(channel, ...args) {
|
||||
validateIPC(channel);
|
||||
|
||||
ipcRenderer.send(channel, ...args);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
|
||||
*/
|
||||
on(channel, listener) {
|
||||
validateIPC(channel);
|
||||
|
||||
ipcRenderer.on(channel, listener);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
|
||||
*/
|
||||
once(channel, listener) {
|
||||
validateIPC(channel);
|
||||
|
||||
ipcRenderer.once(channel, listener);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
* @param {(event: import('electron').IpcRendererEvent, ...args: any[]) => void} listener
|
||||
*/
|
||||
removeListener(channel, listener) {
|
||||
validateIPC(channel);
|
||||
|
||||
ipcRenderer.removeListener(channel, listener);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Support for methods of webFrame type.
|
||||
*
|
||||
* @type {typeof import('../../base/electron-sandbox/globals').webFrame}
|
||||
*/
|
||||
webFrame: {
|
||||
|
||||
getZoomFactor() {
|
||||
return webFrame.getZoomFactor();
|
||||
},
|
||||
|
||||
getZoomLevel() {
|
||||
return webFrame.getZoomLevel();
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {number} level
|
||||
*/
|
||||
setZoomLevel(level) {
|
||||
webFrame.setZoomLevel(level);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//#region Utilities
|
||||
|
||||
/**
|
||||
* @param {string} channel
|
||||
*/
|
||||
function validateIPC(channel) {
|
||||
if (!channel || !channel.startsWith('vscode:')) {
|
||||
throw new Error(`Unsupported event IPC channel '${channel}'`);
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}());
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import 'vs/css!./media/processExplorer';
|
||||
import { clipboard } from 'electron';
|
||||
import { webFrame, ipcRenderer } from 'vs/base/electron-sandbox/globals';
|
||||
import { webFrame, ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { repeat } from 'vs/base/common/strings';
|
||||
import { totalmem } from 'os';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
|
||||
@@ -27,7 +27,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper
|
||||
import { TelemetryAppenderChannel } from 'vs/platform/telemetry/node/telemetryIpc';
|
||||
import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry/common/telemetryService';
|
||||
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
|
||||
import { ipcRenderer } from 'vs/base/electron-sandbox/globals';
|
||||
import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { ILogService, LogLevel, ILoggerService } from 'vs/platform/log/common/log';
|
||||
import { LoggerChannelClient, FollowerLogService } from 'vs/platform/log/common/logIpc';
|
||||
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
|
||||
|
||||
@@ -42,7 +42,7 @@ export class SharedProcess implements ISharedProcess {
|
||||
show: false,
|
||||
backgroundColor: this.themeMainService.getBackgroundColor(),
|
||||
webPreferences: {
|
||||
preload: URI.parse(require.toUrl('vs/code/electron-browser/preload.js')).fsPath,
|
||||
preload: URI.parse(require.toUrl('vs/base/parts/sandbox/electron-browser/preload.js')).fsPath,
|
||||
images: false,
|
||||
nodeIntegration: true,
|
||||
webgl: false,
|
||||
|
||||
@@ -779,7 +779,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
}
|
||||
|
||||
private doGetPreloadUrl(): string {
|
||||
return require.toUrl('vs/code/electron-browser/preload.js');
|
||||
return require.toUrl('vs/base/parts/sandbox/electron-browser/preload.js');
|
||||
}
|
||||
|
||||
serializeWindowState(): IWindowState {
|
||||
|
||||
Reference in New Issue
Block a user