fix(desktop): allow about:blank popup for PDF export fallback (#1081)

The renderer's PDF export fallback uses window.open('', '_blank')
to open a blank window that is then navigated to a Blob URL.
Electron's setWindowOpenHandler only allowed blob: and od: protocols,
so about:blank was denied and the user saw a "Popup blocked" alert.

Fix: add about:blank to the allowed child window URL whitelist.

Co-authored-by: Ken <hitken@users.noreply.github.com>
This commit is contained in:
郭一通 2026-05-10 12:21:15 +08:00 committed by GitHub
parent 9079c51ba3
commit 13005f4fea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -584,7 +584,15 @@ export function isAllowedChildWindowUrl(url: string): boolean {
// its links resolve to `http://127.0.0.1:.../...`, which is gated
// by the separate `isHttpUrl` branch and continues to open in the
// user's external browser via `shell.openExternal`.
return parsed.protocol === "blob:" || parsed.protocol === "od:";
// `about:blank` is used by the renderer's PDF export fallback path:
// `window.open('', '_blank')` opens a blank window that is then
// navigated to a Blob URL. Without this, the empty URL is denied
// and the user sees a "Popup blocked" alert.
return (
parsed.protocol === "blob:" ||
parsed.protocol === "od:" ||
(parsed.protocol === "about:" && parsed.pathname === "blank")
);
} catch {
return false;
}