Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): a phone can watch an agent's hidden browser tab while Windows is locked #39198

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/39198/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 42 additions and 3 deletions.

x
0 of 2 viewed, 2 left
21 additions and 3 deletionsapps/desktop/src/preview/Manager.test.tsModified
View file
@@ -2415,10 +2415,18 @@
Effect.gen(function* () {
const host = yield* DesktopBrowserHost.DesktopBrowserHost;
const serverTab = { threadId: "thread-1", tabId: "server-tab-1" };
+ const windowThrottling = vi.fn<(enabled: boolean) => void>();
+ const mainWebContents = Object.assign(makeTestHostWebContents(), {
+ setBackgroundThrottling: windowThrottling,
+ });
const contents = Object.assign(
- makeTestPreviewWebContents(async () => {
- throw new Error("unused");
- }, 42),
+ makeTestPreviewWebContents(
+ async () => {
+ throw new Error("unused");
+ },
+ 42,
+ mainWebContents,
+ ),
isDevToolsOpened: () => false,
getUserAgent: () => "Electron",
@@ -2431,6 +2439,11 @@
) as unknown as typeof contents.debugger.sendCommand;
fromId.mockReturnValue(contents);
const manager = yield* PreviewManager.PreviewManager;
+ yield* manager.setMainWindow({
+ isDestroyed: () => false,
+ once: vi.fn(),