[MM-45031] Don't use infinite background retry logic when the certificate is invalid (#2153)

This commit is contained in:
Devin Binnie
2022-06-15 09:22:21 -04:00
committed by GitHub
parent 537ed1dd0c
commit 0c5b612489
4 changed files with 41 additions and 1 deletions

View File

@@ -174,6 +174,13 @@ export class MattermostView extends EventEmitter {
log.info(`[${Util.shorten(this.tab.name)}] Loading ${loadURL}`);
const loading = this.view.webContents.loadURL(loadURL, {userAgent: composeUserAgent()});
loading.then(this.loadSuccess(loadURL)).catch((err) => {
if (err.code && err.code.startsWith('ERR_CERT')) {
WindowManager.sendToRenderer(LOAD_FAILED, this.tab.name, err.toString(), loadURL.toString());
this.emit(LOAD_FAILED, this.tab.name, err.toString(), loadURL.toString());
log.info(`[${Util.shorten(this.tab.name)}] Invalid certificate, stop retrying until the user decides what to do: ${err}.`);
this.status = Status.ERROR;
return;
}
this.loadRetry(loadURL, err);
});
}