Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): hidden preview tabs throttle instead of running at full speed #25184

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 17 commits intomain fromrefs/pull/25184/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 19 changed files with 38 additions and 6 deletions (loading 17).

x
0 of 19 viewed, 19 left
27 additions and 4 deletionsapps/desktop/src/preview/CdpRelay.test.tsModified
View file
@@ -65,8 +65,8 @@
]);
pending[0]!();
await settle();
- expect(send).toHaveBeenNthCalledWith(1, "Page.captureScreenshot", {}, undefined);
- expect(send).toHaveBeenNthCalledWith(2, "DOM.enable", {}, "iframe-session");
+ expect(send).toHaveBeenNthCalledWith(1, "Page.captureScreenshot", {}, undefined, undefined);
+ expect(send).toHaveBeenNthCalledWith(2, "DOM.enable", {}, "iframe-session", undefined);
expect(written.at(-1)).toEqual({
id: 5,
result: { method: "Page.captureScreenshot" },
@@ -92,7 +92,30 @@
}),
);
await settle();
- expect(send.mock.calls).toEqual([["Runtime.runIfWaitingForDebugger", {}, "iframe-session"]]);
+ expect(send.mock.calls).toEqual([
+ ["Runtime.runIfWaitingForDebugger", {}, "iframe-session", undefined],
+ ]);
+ });
+​
+ // Playwright enables focus emulation on every page it connects to, and Chromium then
+ // counts the guest as captured: a preview the panel hides keeps its timers unthrottled.
+ it("acknowledges Playwright's focus emulation without forcing it onto the guest", async () => {
+ const send = vi.fn(async () => ({}));
+ const written: Array<Record<string, unknown>> = [];
+ const relay = createCdpRelayConnection(makeTarget(send), (raw) =>
+ written.push(JSON.parse(raw)),
+ );