mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Ignore errors and UI interactions in fetch tool
This commit is contained in:
@@ -72,6 +72,13 @@ export class WebPageLoader extends Disposable {
|
||||
.once('did-fail-load', this.onFailLoad.bind(this))
|
||||
.once('will-navigate', this.onRedirect.bind(this))
|
||||
.once('will-redirect', this.onRedirect.bind(this));
|
||||
|
||||
// Disable any UI interactions that could interfere with content loading.
|
||||
this._window.webContents
|
||||
.on('login', (event) => event.preventDefault())
|
||||
.on('select-client-certificate', (event) => event.preventDefault())
|
||||
.on('certificate-error', (event) => event.preventDefault());
|
||||
|
||||
}
|
||||
|
||||
private trace(message: string) {
|
||||
@@ -164,7 +171,12 @@ export class WebPageLoader extends Disposable {
|
||||
}
|
||||
|
||||
this.trace(`Received 'did-fail-load' event, code: ${statusCode}, error: '${error}'`);
|
||||
void this._queue.queue(() => this.extractContent({ status: 'error', statusCode, error }));
|
||||
if (statusCode === -3) {
|
||||
this.trace(`Ignoring ERR_ABORTED (-3) as it may be caused by CSP or other measures`);
|
||||
void this._queue.queue(() => this.extractContent());
|
||||
} else {
|
||||
void this._queue.queue(() => this.extractContent({ status: 'error', statusCode, error }));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user