Skip to content

Commit

Permalink
Move CDN fallback revision from settings to globalState (#1024)
Browse files Browse the repository at this point in the history
This primarily needs to hold the most recent successful hash and does not need to be configured by the user.
  • Loading branch information
antross authored May 10, 2022
1 parent 02746ff commit 16ac705
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,6 @@
"type": "boolean",
"default": true,
"description": "Enable feedback from webhint on source files to improve accessibility, compatibility, security and more."
},
"vscode-edge-devtools.fallbackRevision": {
"type": "string",
"default": "@a41122be052fe9616f0def5fe6842fa942930d46",
"description": "Last known good revision used for when we fail to connect to the CDN with the current target revision."
}
}
},
Expand Down
5 changes: 2 additions & 3 deletions src/devtoolsPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,10 @@ export class DevToolsPanel {

private onSocketDevToolsConnection(success: string) {
if (success === 'true') {
void vscode.workspace.getConfiguration(SETTINGS_STORE_NAME).update('fallbackRevision', this.currentRevision, true);
void this.context.globalState.update('fallbackRevision', this.currentRevision);
} else {
// Retry connection with fallback.
const settingsConfig = vscode.workspace.getConfiguration(SETTINGS_STORE_NAME);
const fallbackRevision = settingsConfig.get('fallbackRevision') as string;
const fallbackRevision = this.context.globalState.get<string>('fallbackRevision') ?? '';
if (this.currentRevision) {
this.telemetryReporter.sendTelemetryEvent('websocket/failedConnection', {revision: this.currentRevision});
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ export const SETTINGS_DEFAULT_ENTRY_POINT = 'index.html';
const WIN_APP_DATA = process.env.LOCALAPPDATA || '/';
const msEdgeBrowserMapping: Map<BrowserFlavor, IBrowserPath> = new Map<BrowserFlavor, IBrowserPath>();

// Current Revision: 94.0.992.31
export const CDN_FALLBACK_REVISION = '@fd65e6bbedc86a22f2393b7cd8d1585c54cada42';
// Current Revision: 102.0.1235.1
export const CDN_FALLBACK_REVISION = '@a41122be052fe9616f0def5fe6842fa942930d46';

/** Build-specified flags. */
declare const DEBUG: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/versionSocketConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { EventEmitter } from 'events';
import WebSocket from 'ws';
import { WebSocketEvent } from './common/webviewEvents';
import { CDN_FALLBACK_REVISION } from './utils';

export type IDevToolsPostMessageCallback = (e: WebSocketEvent, message?: string) => void;

Expand All @@ -17,7 +18,7 @@ export interface BrowserVersionCdpResponse {

// Minimum supported version of Edge for source-mapped CSS mirroring
export const MIN_SUPPORTED_VERSION = '103.0.1252.0';
export const MIN_SUPPORTED_REVISION = '@a41122be052fe9616f0def5fe6842fa942930d46';
export const MIN_SUPPORTED_REVISION = CDN_FALLBACK_REVISION;

export class BrowserVersionDetectionSocket extends EventEmitter {
private readonly targetUrl: string;
Expand Down

0 comments on commit 16ac705

Please sign in to comment.