From b486354d6e30f39d907a2f58d2e4d3dd187a7e83 Mon Sep 17 00:00:00 2001 From: Florian Ritterhoff <32478819+fritterhoff@users.noreply.github.com> Date: Fri, 9 Sep 2022 18:28:54 +0200 Subject: [PATCH] Update to 1.71 (#5535) * chore: update upstream code * update patches for vs 1.71.0 the cli fix seems to be fixed in upstream, the telemtry patch requires (again) some fixing and adjustments. * add safari fix. * increase ci timeout Co-authored-by: Joe Previte --- .github/workflows/ci.yaml | 2 +- lib/vscode | 2 +- patches/cli-window-open.diff | 68 ++---------------------- patches/disable-builtin-ext-update.diff | 4 +- patches/heartbeat.diff | 2 +- patches/insecure-notification.diff | 3 +- patches/proposed-api.diff | 2 +- patches/proxy-uri.diff | 28 +++++----- patches/safari-console.diff | 13 +++++ patches/series | 1 + patches/sourcemaps.diff | 6 +-- patches/telemetry.diff | 70 +++++++++++++++++-------- 12 files changed, 89 insertions(+), 112 deletions(-) create mode 100644 patches/safari-console.diff diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7d7607f3c..c602d0130 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,7 +25,7 @@ jobs: prebuild: name: Pre-build checks runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 20 steps: - name: Checkout repo uses: actions/checkout@v3 diff --git a/lib/vscode b/lib/vscode index e4503b30f..784b0177c 160000 --- a/lib/vscode +++ b/lib/vscode @@ -1 +1 @@ -Subproject commit e4503b30fc78200f846c62cf8091b76ff5547662 +Subproject commit 784b0177c56c607789f9638da7b6bf3230d47a8c diff --git a/patches/cli-window-open.diff b/patches/cli-window-open.diff index 6c7621cb4..8b5d09d96 100644 --- a/patches/cli-window-open.diff +++ b/patches/cli-window-open.diff @@ -13,62 +13,15 @@ To test: The file or directory should only open from the instance attached to that terminal. -Index: code-server/lib/vscode/src/vs/server/node/remoteTerminalChannel.ts -=================================================================== ---- code-server.orig/lib/vscode/src/vs/server/node/remoteTerminalChannel.ts -+++ code-server/lib/vscode/src/vs/server/node/remoteTerminalChannel.ts -@@ -89,7 +89,7 @@ export class RemoteTerminalChannel exten - uriTransformer: IURITransformer; - }>(); - -- private readonly _onExecuteCommand = this._register(new Emitter<{ reqId: number; commandId: string; commandArgs: any[] }>()); -+ private readonly _onExecuteCommand = this._register(new Emitter<{ reqId: number; terminalId: number; commandId: string; commandArgs: any[] }>()); - readonly onExecuteCommand = this._onExecuteCommand.event; - - constructor( -@@ -241,20 +241,20 @@ export class RemoteTerminalChannel exten - const ipcHandlePath = createRandomIPCHandle(); - env.VSCODE_IPC_HOOK_CLI = ipcHandlePath; - const commandsExecuter: ICommandsExecuter = { -- executeCommand: (id: string, ...args: any[]): Promise => this._executeCommand(id, args, uriTransformer) -+ executeCommand: (commandId: string, ...args: any[]): Promise => this._executeCommand(terminalId, commandId, args, uriTransformer) - }; - const cliServer = new CLIServerBase(commandsExecuter, this._logService, ipcHandlePath); - -- const id = await this._ptyService.createProcess(shellLaunchConfig, initialCwd, args.cols, args.rows, args.unicodeVersion, env, baseEnv, args.options, args.shouldPersistTerminal, args.workspaceId, args.workspaceName); -- this._ptyService.onProcessExit(e => e.id === id && cliServer.dispose()); -+ const terminalId = await this._ptyService.createProcess(shellLaunchConfig, initialCwd, args.cols, args.rows, args.unicodeVersion, env, baseEnv, args.options, args.shouldPersistTerminal, args.workspaceId, args.workspaceName); -+ this._ptyService.onProcessExit(e => e.id === terminalId && cliServer.dispose()); - - return { -- persistentTerminalId: id, -+ persistentTerminalId: terminalId, - resolvedShellLaunchConfig: shellLaunchConfig - }; - } - -- private _executeCommand(commandId: string, commandArgs: any[], uriTransformer: IURITransformer): Promise { -+ private _executeCommand(terminalId: number, commandId: string, commandArgs: any[], uriTransformer: IURITransformer): Promise { - let resolve!: (data: any) => void; - let reject!: (err: any) => void; - const result = new Promise((_resolve, _reject) => { -@@ -277,6 +277,7 @@ export class RemoteTerminalChannel exten - }); - this._onExecuteCommand.fire({ - reqId, -+ terminalId, - commandId, - commandArgs: serializedCommandArgs - }); Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTerminalBackend.ts -@@ -94,10 +94,14 @@ class RemoteTerminalBackend extends Base - this._remoteTerminalChannel.onExecuteCommand(async e => { +@@ -99,10 +99,14 @@ class RemoteTerminalBackend extends Base + } const reqId = e.reqId; const commandId = e.commandId; -+ const terminalId = e.terminalId; ++ const terminalId = e.persistentProcessId; if (!allowedCommands.includes(commandId)) { this._remoteTerminalChannel.sendCommandResult(reqId, true, 'Invalid remote cli command: ' + commandId); return; @@ -79,18 +32,3 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/remoteTe const commandArgs = e.commandArgs.map(arg => revive(arg)); try { const result = await this._commandService.executeCommand(e.commandId, ...commandArgs); -Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts -=================================================================== ---- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts -+++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/common/remoteTerminalChannel.ts -@@ -88,8 +88,8 @@ export class RemoteTerminalChannelClient - get onProcessOrphanQuestion(): Event<{ id: number }> { - return this._channel.listen<{ id: number }>('$onProcessOrphanQuestion'); - } -- get onExecuteCommand(): Event<{ reqId: number; commandId: string; commandArgs: any[] }> { -- return this._channel.listen<{ reqId: number; commandId: string; commandArgs: any[] }>('$onExecuteCommand'); -+ get onExecuteCommand(): Event<{ reqId: number; terminalId: number; commandId: string; commandArgs: any[] }> { -+ return this._channel.listen<{ reqId: number; terminalId: number; commandId: string; commandArgs: any[] }>('$onExecuteCommand'); - } - get onDidRequestDetach(): Event<{ requestId: number; workspaceId: string; instanceId: number }> { - return this._channel.listen<{ requestId: number; workspaceId: string; instanceId: number }>('$onDidRequestDetach'); diff --git a/patches/disable-builtin-ext-update.diff b/patches/disable-builtin-ext-update.diff index ddb35bae2..69ea92048 100644 --- a/patches/disable-builtin-ext-update.diff +++ b/patches/disable-builtin-ext-update.diff @@ -7,7 +7,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts -@@ -237,6 +237,10 @@ export class Extension implements IExten +@@ -236,6 +236,10 @@ export class Extension implements IExten if (this.type === ExtensionType.System && this.productService.quality === 'stable') { return false; } @@ -18,7 +18,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) { return false; } -@@ -1122,6 +1126,10 @@ export class ExtensionsWorkbenchService +@@ -1121,6 +1125,10 @@ export class ExtensionsWorkbenchService // Skip if check updates only for builtin extensions and current extension is not builtin. continue; } diff --git a/patches/heartbeat.diff b/patches/heartbeat.diff index 4a7125a7b..c8d619140 100644 --- a/patches/heartbeat.diff +++ b/patches/heartbeat.diff @@ -15,7 +15,7 @@ Index: code-server/lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts export const enum SocketDiagnosticsEventType { Created = 'created', -@@ -829,6 +830,19 @@ export class PersistentProtocol implemen +@@ -849,6 +850,19 @@ export class PersistentProtocol implemen this._socketDisposables.push(this._socketWriter); this._socketReader = new ProtocolReader(this._socket); this._socketDisposables.push(this._socketReader); diff --git a/patches/insecure-notification.diff b/patches/insecure-notification.diff index 364ef175a..f589b85d7 100644 --- a/patches/insecure-notification.diff +++ b/patches/insecure-notification.diff @@ -27,7 +27,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts ) { super(); } -@@ -42,5 +45,32 @@ export class CodeServerClient extends Di +@@ -42,5 +45,31 @@ export class CodeServerClient extends Di } }); } @@ -49,7 +49,6 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts + class: undefined, + enabled: true, + checked: true, -+ dispose: () => undefined, + run: () => { + return Promise.resolve(); + }, diff --git a/patches/proposed-api.diff b/patches/proposed-api.diff index 904ef7d2c..09333557b 100644 --- a/patches/proposed-api.diff +++ b/patches/proposed-api.diff @@ -9,7 +9,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/extensions/common/abstra =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts +++ code-server/lib/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.ts -@@ -1460,7 +1460,7 @@ class ProposedApiController { +@@ -1458,7 +1458,7 @@ class ProposedApiController { this._envEnabledExtensions = new Set((_environmentService.extensionEnabledProposedApi ?? []).map(id => ExtensionIdentifier.toKey(id))); diff --git a/patches/proxy-uri.diff b/patches/proxy-uri.diff index a83414555..c5ed301b2 100644 --- a/patches/proxy-uri.diff +++ b/patches/proxy-uri.diff @@ -35,19 +35,19 @@ Index: code-server/lib/vscode/src/vs/platform/remote/browser/remoteAuthorityReso import { getRemoteServerRootPath, parseAuthorityWithOptionalPort } from 'vs/platform/remote/common/remoteHosts'; export class RemoteAuthorityResolverService extends Disposable implements IRemoteAuthorityResolverService { -@@ -22,7 +22,7 @@ export class RemoteAuthorityResolverServ - private readonly _connectionToken: string | undefined; +@@ -23,7 +23,7 @@ export class RemoteAuthorityResolverServ + private readonly _connectionToken: Promise | string | undefined; private readonly _connectionTokens: Map; -- constructor(@IProductService productService: IProductService, connectionToken: string | undefined, resourceUriProvider: ((uri: URI) => URI) | undefined) { -+ constructor(@IProductService productService: IProductService, connectionToken: string | undefined, resourceUriProvider: ((uri: URI) => URI) | undefined, private readonly proxyEndpointTemplate?: string) { +- constructor(@IProductService productService: IProductService, connectionToken: Promise | string | undefined, resourceUriProvider: ((uri: URI) => URI) | undefined) { ++ constructor(@IProductService productService: IProductService, connectionToken: Promise | string | undefined, resourceUriProvider: ((uri: URI) => URI) | undefined, private readonly proxyEndpointTemplate?: string) { super(); - this._cache = new Map(); this._connectionToken = connectionToken; -@@ -62,9 +62,14 @@ export class RemoteAuthorityResolverServ + this._connectionTokens = new Map(); +@@ -61,9 +61,14 @@ export class RemoteAuthorityResolverServ - private _doResolveAuthority(authority: string): ResolverResult { - const connectionToken = this._connectionTokens.get(authority) || this._connectionToken; + private async _doResolveAuthority(authority: string): Promise { + const connectionToken = await Promise.resolve(this._connectionTokens.get(authority) || this._connectionToken); + let options: ResolvedOptions | undefined; + if (this.proxyEndpointTemplate) { + const proxyUrl = new URL(this.proxyEndpointTemplate, window.location.href); @@ -55,11 +55,11 @@ Index: code-server/lib/vscode/src/vs/platform/remote/browser/remoteAuthorityReso + } const defaultPort = (/^https:/.test(window.location.href) ? 443 : 80); const { host, port } = parseAuthorityWithOptionalPort(authority, defaultPort); -- return { authority: { authority, host: host, port: port, connectionToken } }; -+ return { authority: { authority, host: host, port: port, connectionToken }, options }; - } - - _clearResolvedAuthority(authority: string): void { +- const result: ResolverResult = { authority: { authority, host: host, port: port, connectionToken } }; ++ const result: ResolverResult = { authority: { authority, host: host, port: port, connectionToken }, options }; + RemoteAuthorities.set(authority, result.authority.host, result.authority.port); + this._cache.set(authority, result); + this._onDidChangeConnectionData.fire(); Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts @@ -76,7 +76,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts +++ code-server/lib/vscode/src/vs/workbench/browser/web.main.ts -@@ -239,7 +239,7 @@ export class BrowserMain extends Disposa +@@ -247,7 +247,7 @@ export class BrowserMain extends Disposa // Remote const connectionToken = environmentService.options.connectionToken || getCookieValue(connectionTokenCookieName); diff --git a/patches/safari-console.diff b/patches/safari-console.diff new file mode 100644 index 000000000..7164d03f5 --- /dev/null +++ b/patches/safari-console.diff @@ -0,0 +1,13 @@ +Index: code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts +=================================================================== +--- code-server.orig/lib/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts ++++ code-server/lib/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts +@@ -286,7 +286,7 @@ export class XtermTerminal extends Dispo + } + + private _shouldLoadCanvas(): boolean { +- return (this._configHelper.config.gpuAcceleration === 'auto' && (XtermTerminal._suggestedRendererType === undefined || XtermTerminal._suggestedRendererType === 'canvas')) || this._configHelper.config.gpuAcceleration === 'canvas'; ++ return !isSafari && (this._configHelper.config.gpuAcceleration === 'auto' && (XtermTerminal._suggestedRendererType === undefined || XtermTerminal._suggestedRendererType === 'canvas')) || this._configHelper.config.gpuAcceleration === 'canvas'; + } + + forceRedraw() { diff --git a/patches/series b/patches/series index 40ebf2706..c8f1bb595 100644 --- a/patches/series +++ b/patches/series @@ -22,3 +22,4 @@ display-language.diff cli-window-open.diff heartbeat.diff exec-argv.diff +safari-console.diff diff --git a/patches/sourcemaps.diff b/patches/sourcemaps.diff index fb252cfec..22c593a3e 100644 --- a/patches/sourcemaps.diff +++ b/patches/sourcemaps.diff @@ -10,7 +10,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js =================================================================== --- code-server.orig/lib/vscode/build/gulpfile.reh.js +++ code-server/lib/vscode/build/gulpfile.reh.js -@@ -194,8 +194,7 @@ function packageTask(type, platform, arc +@@ -196,8 +196,7 @@ function packageTask(type, platform, arc const src = gulp.src(sourceFolderName + '/**', { base: '.' }) .pipe(rename(function (path) { path.dirname = path.dirname.replace(new RegExp('^' + sourceFolderName), 'out'); })) @@ -20,7 +20,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js const workspaceExtensionPoints = ['debuggers', 'jsonValidation']; const isUIExtension = (manifest) => { -@@ -234,9 +233,9 @@ function packageTask(type, platform, arc +@@ -236,9 +235,9 @@ function packageTask(type, platform, arc .map(name => `.build/extensions/${name}/**`); const extensions = gulp.src(extensionPaths, { base: '.build', dot: true }); @@ -32,7 +32,7 @@ Index: code-server/lib/vscode/build/gulpfile.reh.js let version = packageJson.version; const quality = product.quality; -@@ -371,7 +370,7 @@ function tweakProductForServerWeb(produc +@@ -373,7 +372,7 @@ function tweakProductForServerWeb(produc const minifyTask = task.define(`minify-vscode-${type}`, task.series( optimizeTask, util.rimraf(`out-vscode-${type}-min`), diff --git a/patches/telemetry.diff b/patches/telemetry.diff index 58292503e..f4a985590 100644 --- a/patches/telemetry.diff +++ b/patches/telemetry.diff @@ -1,5 +1,7 @@ Add support for telemetry endpoint +Contains some fixes included in https://github.com/microsoft/vscode/commit/b108bc8294ce920fcf2ee8d53f97c3bcf3316e1c + Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/server/node/serverServices.ts @@ -86,12 +88,45 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/services/telemetry/browser/telemetryService.ts +++ code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/telemetryService.ts -@@ -38,26 +38,30 @@ export class TelemetryService extends Di +@@ -15,7 +15,7 @@ import { ClassifiedEvent, IGDPRProperty, + import { ITelemetryData, ITelemetryInfo, ITelemetryService, TelemetryLevel, TELEMETRY_SETTING_ID } from 'vs/platform/telemetry/common/telemetry'; + import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogAppender'; + import { ITelemetryServiceConfig, TelemetryService as BaseTelemetryService } from 'vs/platform/telemetry/common/telemetryService'; +-import { isInternalTelemetry, ITelemetryAppender, NullTelemetryService, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils'; ++import { getTelemetryLevel, isInternalTelemetry, ITelemetryAppender, NullTelemetryService, supportsTelemetry } from 'vs/platform/telemetry/common/telemetryUtils'; + import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService'; + import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; + import { resolveWorkbenchCommonProperties } from 'vs/workbench/services/telemetry/browser/workbenchCommonProperties'; +@@ -24,7 +24,7 @@ export class TelemetryService extends Di + + declare readonly _serviceBrand: undefined; + +- private impl: ITelemetryService; ++ private impl: ITelemetryService = NullTelemetryService; + public readonly sendErrorTelemetry = true; + + constructor( +@@ -37,11 +37,7 @@ export class TelemetryService extends Di ) { super(); - if (supportsTelemetry(productService, environmentService) && productService.aiConfig?.ariaKey) { -+ if (supportsTelemetry(productService, environmentService)) { +- this.impl = this.initializeService(environmentService, loggerService, configurationService, storageService, productService, remoteAgentService); +- } else { +- this.impl = NullTelemetryService; +- } ++ this.impl = this.initializeService(environmentService, loggerService, configurationService, storageService, productService, remoteAgentService); + + // When the level changes it could change from off to on and we want to make sure telemetry is properly intialized + this._register(configurationService.onDidChangeConfiguration(e => { +@@ -64,23 +60,28 @@ export class TelemetryService extends Di + productService: IProductService, + remoteAgentService: IRemoteAgentService + ) { +- const telemetrySupported = supportsTelemetry(productService, environmentService) && productService.aiConfig?.ariaKey; +- if (telemetrySupported && this.impl === NullTelemetryService && this.telemetryLevel.value !== TelemetryLevel.NONE) { ++ const telemetrySupported = supportsTelemetry(productService, environmentService); ++ if (telemetrySupported && getTelemetryLevel(configurationService) !== TelemetryLevel.NONE && this.impl === NullTelemetryService) { // If remote server is present send telemetry through that, else use the client side appender const appenders = []; const isInternal = isInternalTelemetry(productService, configurationService); @@ -103,14 +138,6 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme - commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, isInternal, environmentService.remoteAuthority, productService.embedderIdentifier, productService.removeTelemetryMachineId, environmentService.options && environmentService.options.resolveCommonTelemetryProperties), - sendErrorTelemetry: this.sendErrorTelemetry, - }; -- this.impl = this._register(new BaseTelemetryService(config, configurationService, productService)); -- -- if (getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) { -- // If we cannot fetch the endpoint it means it is down and we should not send any telemetry. -- // This is most likely due to ad blockers -- fetch(telemetryEndpointUrl, { method: 'POST' }).catch(err => { -- this.impl = NullTelemetryService; -- }); + const telemetryProvider: ITelemetryAppender | undefined = remoteAgentService.getConnection() !== null ? { log: remoteAgentService.logTelemetry.bind(remoteAgentService), flush: remoteAgentService.flushTelemetry.bind(remoteAgentService) } : productService.aiConfig?.ariaKey ? new OneDataSystemWebAppender(isInternal, 'monacoworkbench', null, productService.aiConfig?.ariaKey) : undefined; + if (telemetryProvider) { + appenders.push(telemetryProvider); @@ -120,20 +147,19 @@ Index: code-server/lib/vscode/src/vs/workbench/services/telemetry/browser/teleme + commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, isInternal, environmentService.remoteAuthority, productService.embedderIdentifier, productService.removeTelemetryMachineId, environmentService.options && environmentService.options.resolveCommonTelemetryProperties), + sendErrorTelemetry: this.sendErrorTelemetry, + }; -+ this.impl = this._register(new BaseTelemetryService(config, configurationService, productService)); + -+ if (remoteAgentService.getConnection() === null && getTelemetryLevel(configurationService) !== TelemetryLevel.NONE) { -+ // If we cannot fetch the endpoint it means it is down and we should not send any telemetry. -+ // This is most likely due to ad blockers -+ fetch(telemetryEndpointUrl, { method: 'POST' }).catch(err => { -+ this.impl = NullTelemetryService; -+ }); -+ } ++ return this._register(new BaseTelemetryService(config, configurationService, productService)); + } else { -+ this.impl = NullTelemetryService; - } - } else { - this.impl = NullTelemetryService; ++ return this.impl; ++ } + +- return this._register(new BaseTelemetryService(config, configurationService, productService)); + } +- return NullTelemetryService; ++ return this.impl; + } + + setExperimentProperty(name: string, value: string): void { Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts =================================================================== --- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts