Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)

This commit is contained in:
Cory Rivera
2021-08-25 16:28:29 -07:00
committed by GitHub
parent ab1112bfb3
commit cb7b7da0a4
1752 changed files with 59525 additions and 33878 deletions
@@ -22,7 +22,7 @@ export class ProtocolMainService extends Disposable implements IProtocolMainServ
declare readonly _serviceBrand: undefined;
private readonly validRoots = TernarySearchTree.forUris<boolean>(() => !isLinux);
private readonly validExtensions = new Set(['.png', '.jpg', '.jpeg', '.gif', '.bmp']); // https://github.com/microsoft/vscode/issues/119384
private readonly validExtensions = new Set(['.svg', '.png', '.jpg', '.jpeg', '.gif', '.bmp']); // https://github.com/microsoft/vscode/issues/119384
constructor(
@INativeEnvironmentService environmentService: INativeEnvironmentService,
@@ -47,10 +47,10 @@ export class ProtocolMainService extends Disposable implements IProtocolMainServ
const { defaultSession } = session;
// Register vscode-file:// handler
defaultSession.protocol.registerFileProtocol(Schemas.vscodeFileResource, (request, callback) => this.handleResourceRequest(request, callback as unknown as ProtocolCallback));
defaultSession.protocol.registerFileProtocol(Schemas.vscodeFileResource, (request, callback) => this.handleResourceRequest(request, callback));
// Intercept any file:// access
defaultSession.protocol.interceptFileProtocol(Schemas.file, (request, callback) => this.handleFileRequest(request, callback as unknown as ProtocolCallback));
defaultSession.protocol.interceptFileProtocol(Schemas.file, (request, callback) => this.handleFileRequest(request, callback));
// Cleanup
this._register(toDisposable(() => {
@@ -142,7 +142,8 @@ export class ProtocolMainService extends Disposable implements IProtocolMainServ
//#region IPC Object URLs
createIPCObjectUrl<T>(obj: T): IIPCObjectUrl<T> {
createIPCObjectUrl<T>(): IIPCObjectUrl<T> {
let obj: T | undefined = undefined;
// Create unique URI
const resource = URI.from({
@@ -152,7 +153,7 @@ export class ProtocolMainService extends Disposable implements IProtocolMainServ
// Install IPC handler
const channel = resource.toString();
const handler = async (): Promise<T> => obj;
const handler = async (): Promise<T | undefined> => obj;
ipcMain.handle(channel, handler);
this.logService.trace(`IPC Object URL: Registered new channel ${channel}.`);