From 2002d856f29d0372e427d25e4dc05ebbf7800a2b Mon Sep 17 00:00:00 2001 From: Vidal Ortega <43078681+vidorteg@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:15:34 -0700 Subject: [PATCH] Fix: Updating fallback version to 127 Updates fallback version to use Edge 127 also fixes an issue where if the user had a well known version set in the cache it always use that one, even if a new one is present. Close --- .vscode/launch.json | 8 ++++---- src/devtoolsPanel.ts | 32 ++++++++++++++++++++++++++++++-- src/utils.ts | 4 ++-- src/versionSocketConnection.ts | 6 ------ 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a3facfd..0a9531c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,25 +6,25 @@ "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", + "autoAttachChildProcesses": true, "args": [ "--extensionDevelopmentPath=${workspaceFolder}" ], - "stopOnEntry": false, "sourceMaps": true, "outFiles": [ "${workspaceFolder}/out/**/*.js" ], - "preLaunchTask": "npm: build" + "preLaunchTask": "npm: build-debug" }, { "name": "Launch Extension Edge Watch", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", + "autoAttachChildProcesses": true, "args": [ "--extensionDevelopmentPath=${workspaceFolder}" ], - "stopOnEntry": false, "sourceMaps": true, "outFiles": [ "${workspaceFolder}/out/**/*.js" @@ -36,10 +36,10 @@ "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", + "autoAttachChildProcesses": true, "args": [ "--extensionDevelopmentPath=${workspaceFolder}" ], - "stopOnEntry": false, "sourceMaps": true, "outFiles": [ "${workspaceFolder}/out/**/*.js" diff --git a/src/devtoolsPanel.ts b/src/devtoolsPanel.ts index 91f8ebf..6b82504 100644 --- a/src/devtoolsPanel.ts +++ b/src/devtoolsPanel.ts @@ -406,12 +406,40 @@ export class DevToolsPanel { private onSocketDevToolsConnection(success: string) { if (success === 'true') { void this.context.globalState.update('fallbackRevision', this.currentRevision); + this.context.globalState.update('retryAttemptToLoadCDN', '1'); } else { - // Retry connection with fallback. - const fallbackRevision = this.context.globalState.get('fallbackRevision') ?? ''; + let retryNumber: number; + try { + retryNumber = parseInt(this.context.globalState.get('retryAttemptToLoadCDN') || '1', 10); + } catch { + retryNumber = 1; + } + + let fallbackRevision; + switch (retryNumber) { + case 1: { + // Always try the latest specified revision first, this will keep it updated. + fallbackRevision = CDN_FALLBACK_REVISION; + this.context.globalState.update('retryAttemptToLoadCDN', ++retryNumber); + break; + } + case 2: { + // Retry connection with latest well known fallback that this environment knows. + fallbackRevision = this.context.globalState.get('fallbackRevision') ?? ''; + this.context.globalState.update('retryAttemptToLoadCDN', ++retryNumber); + break; + } + default: { + // Could not find suitable version. + this.context.globalState.update('retryAttemptToLoadCDN', '1'); + return; + } + } + if (this.currentRevision) { this.telemetryReporter.sendTelemetryEvent('websocket/failedConnection', {revision: this.currentRevision}); } + this.setCdnParameters({revision: fallbackRevision, isHeadless: this.isHeadless}); } } diff --git a/src/utils.ts b/src/utils.ts index 992a869..b1b1cdb 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -109,8 +109,8 @@ export const SETTINGS_DEFAULT_ENTRY_POINT = 'index.html'; const WIN_APP_DATA = process.env.LOCALAPPDATA || '/'; const msEdgeBrowserMapping: Map = new Map(); -// Current Revision: 120.0.2210.181 -export const CDN_FALLBACK_REVISION = '@6e7adbe405f69993cc1eb8c5dc9ea51868c4fb36'; +// Current Revision: 127.0.2594.0 +export const CDN_FALLBACK_REVISION = '@xxf163ae219c3b08cda5aafa6b262442715a8a9893'; /** Build-specified flags. */ declare const DEBUG: boolean; diff --git a/src/versionSocketConnection.ts b/src/versionSocketConnection.ts index a584734..02301bf 100644 --- a/src/versionSocketConnection.ts +++ b/src/versionSocketConnection.ts @@ -77,12 +77,6 @@ export class BrowserVersionDetectionSocket extends EventEmitter { const minSupportedVersion = MIN_SUPPORTED_VERSION.split('.').map(part => Number(part)); const currentRevision = data.result.revision || ''; - // TODO: Workaround https://github.com/microsoft/vscode-edge-devtools/issues/1992 - // remove when it has been fixed - if (parseFloat(versionNum) > 121) { - return {revision: '@d550f77b048ac142a3292397c64cdb693e4aca08', isHeadless}; - } - for (let i = 0; i < currentVersion.length; i++) { // Loop through from Major to minor numbers if (currentVersion[i] > minSupportedVersion[i]) {