Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): preview CDP sessions no longer hard-crash the app #9068

Mergedsethwebster(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/9068/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 81 additions and 12 deletions.

x
0 of 2 viewed, 2 left
61 additions and 0 deletionsapps/desktop/src/preview/Manager.test.tsModified
View file
@@ -533,6 +533,67 @@
​
+ effectIt.effect("detaches through the pinned debugger after the webview is destroyed", () =>
+ withManager((manager) =>
+ Effect.gen(function* () {
+ // Real Electron throws on any `wc.debugger` access once the
+ // WebContents is destroyed, so cleanup must go through the debugger
+ // reference captured at attach time (electron/electron#53376).
+ let destroyed = false;
+ let attached = false;
+ const debuggerOff = vi.fn();
+ const debuggerDetach = vi.fn(() => {
+ attached = false;
+ });
+ const wcDebugger = {
+ isAttached: () => attached,
+ attach: vi.fn(() => {
+ attached = true;
+ }),
+ detach: debuggerDetach,
+ sendCommand: vi.fn(async () => undefined),
+ on: vi.fn(),
+ off: debuggerOff,
+ };
+ fromId.mockReturnValue({
+ id: 42,
+ isDestroyed: () => destroyed,
+ getType: () => "webview",