deno desktop: Deno.BrowserWindow.close()/hide() hangs the UI for secondary windows (macOS)
desktop
### Version
deno 2.9.0+94d375d (canary, release, aarch64-apple-darwin)
`deno desktop`
### Summary
Calling `close()` (or `hide()`) on a **secondary** `Deno.BrowserWindow` (i.e. any window other than the first/adopted main window) hangs the app's UI — the window shows a spinning beachball and never closes. The Deno-side `close()` call itself returns, but the window's UI thread is frozen.
The main (adopted) window closes fine. Other operations on secondary windows (`navigate`, `setTitle`, `setSize`, bindings/HTTP) work normally — only the window-destruction/visibility operations (`close()`, `hide()`) hang.
### Reproduction
Run with `deno desktop repro.ts` on macOS:
```ts
/// <reference lib="deno.desktop" />
const server = Deno.serve(() =>
new Response("<h1>secondary window</h1>", {
headers: { "content-type": "text/html" },
})
);
const origin = `http://127.0.0.1:${server.addr.port}`;
// First BrowserWindow adopts the auto-opened main window.
const _main = new Deno.BrowserWindow({ title: "main", width: 400, height: 200 });
// A second window.
const secondary = new Deno.BrowserWindow({ title: "secondary", width: 400, height: 200 });
secondary.navigate(origin);
secondary.show();
// Close the secondary window programmatically after 3s.
setTimeout(() => {
console.log("calling secondary.close() ...");
secondary.close(); // <-- UI hangs here; the window never closes
console.log("secondary.close() returned");
}, 3000);
```
### Expected
After ~3s the secondary window closes.
### Actual
The secondary window freezes (spinning beachball) and never closes. `"secondary.close() returned"` is printed (the Deno-side call returns), but the window's UI is frozen.
### Additional context
- Reproduces from every calling context: a timer (above), the window's `"close"` event handler, and inside an HTTP request handler. Deferring with `setTimeout(0)` does not help.
- `secondary.hide()` hangs the same way.
- Closing the **main** (first/adopted) window works fine.
关闭于 2026-07-01 3 条评论