mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Fix #138492
This commit is contained in:
parent
322a4c631b
commit
258ca4f8a2
|
@ -137,7 +137,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
|
||||
private readonly touchBarGroups: TouchBarSegmentedControl[] = [];
|
||||
|
||||
private marketplaceHeadersPromise: Promise<object>;
|
||||
private currentHttpProxy: string | undefined = undefined;
|
||||
private currentNoProxy: string | undefined = undefined;
|
||||
|
||||
|
@ -150,7 +149,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
@ILogService private readonly logService: ILogService,
|
||||
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
|
||||
@IFileService private readonly fileService: IFileService,
|
||||
@IStorageMainService storageMainService: IStorageMainService,
|
||||
@IStorageMainService private readonly storageMainService: IStorageMainService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IThemeMainService private readonly themeMainService: IThemeMainService,
|
||||
@IWorkspacesManagementMainService private readonly workspacesManagementMainService: IWorkspacesManagementMainService,
|
||||
|
@ -303,12 +302,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
// macOS: touch bar support
|
||||
this.createTouchBar();
|
||||
|
||||
// Request handling
|
||||
this.marketplaceHeadersPromise = resolveMarketplaceHeaders(this.productService.version, this.productService, this.environmentMainService, this.configurationService, this.fileService, {
|
||||
get: key => storageMainService.globalStorage.get(key),
|
||||
store: (key, value) => storageMainService.globalStorage.set(key, value)
|
||||
});
|
||||
|
||||
// Eventing
|
||||
this.registerListeners();
|
||||
}
|
||||
|
@ -542,12 +535,23 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
// Inject headers when requests are incoming
|
||||
const urls = ['https://marketplace.visualstudio.com/*', 'https://*.vsassets.io/*'];
|
||||
this._win.webContents.session.webRequest.onBeforeSendHeaders({ urls }, async (details, cb) => {
|
||||
const headers = await this.marketplaceHeadersPromise;
|
||||
const headers = await this.getMarketplaceHeaders();
|
||||
|
||||
cb({ cancel: false, requestHeaders: Object.assign(details.requestHeaders, headers) });
|
||||
});
|
||||
}
|
||||
|
||||
private marketplaceHeadersPromise: Promise<object> | undefined;
|
||||
private getMarketplaceHeaders(): Promise<object> {
|
||||
if (!this.marketplaceHeadersPromise) {
|
||||
this.marketplaceHeadersPromise = resolveMarketplaceHeaders(this.productService.version, this.productService, this.environmentMainService, this.configurationService, this.fileService, {
|
||||
get: key => this.storageMainService.globalStorage.get(key),
|
||||
store: (key, value) => this.storageMainService.globalStorage.set(key, value)
|
||||
});
|
||||
}
|
||||
return this.marketplaceHeadersPromise;
|
||||
}
|
||||
|
||||
private async onWindowError(error: WindowError.UNRESPONSIVE): Promise<void>;
|
||||
private async onWindowError(error: WindowError.CRASHED, details: { reason: string, exitCode: number }): Promise<void>;
|
||||
private async onWindowError(error: WindowError.LOAD, details: { reason: string, exitCode: number }): Promise<void>;
|
||||
|
|
Loading…
Reference in a new issue