Skip to content

Commit 7072a41

Browse files
committed
Remove dialog for certificate errors on subresources.
Fixes #1119. Closes #1277. Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 79f6f13 commit 7072a41

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

app/main/index.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type {Event} from "electron/common";
21
import {clipboard} from "electron/common";
32
import type {IpcMainEvent, WebContents} from "electron/main";
43
import {
@@ -306,18 +305,24 @@ function createMainWindow(): BrowserWindow {
306305
app.on(
307306
"certificate-error",
308307
(
309-
event: Event,
310-
webContents: WebContents,
311-
urlString: string,
312-
error: string,
308+
event,
309+
webContents,
310+
urlString,
311+
error,
312+
certificate,
313+
callback,
314+
isMainFrame,
315+
// eslint-disable-next-line max-params
313316
) => {
314-
const url = new URL(urlString);
315-
dialog.showErrorBox(
316-
"Certificate error",
317-
`The server presented an invalid certificate for ${url.origin}:
317+
if (isMainFrame) {
318+
const url = new URL(urlString);
319+
dialog.showErrorBox(
320+
"Certificate error",
321+
`The server presented an invalid certificate for ${url.origin}:
318322
319323
${error}`,
320-
);
324+
);
325+
}
321326
},
322327
);
323328

0 commit comments

Comments
 (0)