Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): reattach a browser tab whose debugger Chromium dropped #17525

Mergedtobymarks(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/17525/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 92 additions and 15 deletions.

x
0 of 2 viewed, 2 left
34 additions and 3 deletionsapps/desktop/src/preview/Manager.test.tsModified
View file
@@ -1886,6 +1886,8 @@
const sendCommand = vi.fn<(method: string, params?: unknown) => Promise<unknown>>(
async () => undefined,
+ const detachListeners = new Set<() => void>();
+ let chromiumDetaches = 0;
let destroyed = false;
const wc = {
@@ -1914,19 +1916,30 @@
setIgnoreMenuShortcuts: vi.fn(),
setWindowOpenHandler: vi.fn(),
debugger: {
- isAttached: () => attach.mock.calls.length > detach.mock.calls.length,
+ isAttached: () => attach.mock.calls.length > detach.mock.calls.length + chromiumDetaches,
attach,
detach,
sendCommand,
- on: vi.fn(),
- off: vi.fn(),
+ on: (event: string, listener: () => void) => {
+ if (event === "detach") detachListeners.add(listener);
+ },
+ off: (event: string, listener: () => void) => {
+ if (event === "detach") detachListeners.delete(listener);
+ },
+ /** Chromium dropping the debugger without a detach() call. */