mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 21:11:38 +01:00
electron - block permissions requests via setPermissionRequestHandler
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { app, ipcMain as ipc, systemPreferences, shell, Event, contentTracing, protocol, powerMonitor, IpcMainEvent, BrowserWindow, dialog } from 'electron';
|
||||
import { app, ipcMain as ipc, systemPreferences, shell, Event, contentTracing, protocol, powerMonitor, IpcMainEvent, BrowserWindow, dialog, session } from 'electron';
|
||||
import { IProcessEnvironment, isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||
import { WindowsMainService } from 'vs/platform/windows/electron-main/windowsMainService';
|
||||
import { IWindowOpenable } from 'vs/platform/windows/common/windows';
|
||||
@@ -129,7 +129,7 @@ export class CodeApplication extends Disposable {
|
||||
}
|
||||
});
|
||||
|
||||
// Security related measures (https://electronjs.org/docs/tutorial/security)
|
||||
//#region Security related measures (https://electronjs.org/docs/tutorial/security)
|
||||
//
|
||||
// !!! DO NOT CHANGE without consulting the documentation !!!
|
||||
//
|
||||
@@ -212,8 +212,14 @@ export class CodeApplication extends Disposable {
|
||||
|
||||
shell.openExternal(url);
|
||||
});
|
||||
|
||||
session.defaultSession.setPermissionRequestHandler((webContents, permission /* 'media' | 'geolocation' | 'notifications' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal' */, callback) => {
|
||||
return callback(false);
|
||||
});
|
||||
});
|
||||
|
||||
//#endregion
|
||||
|
||||
let macOpenFileURIs: IWindowOpenable[] = [];
|
||||
let runningTimeout: NodeJS.Timeout | null = null;
|
||||
app.on('open-file', (event: Event, path: string) => {
|
||||
|
||||
Reference in New Issue
Block a user