Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): idle preview tabs stop running at full speed #24806

Closedjuliusmarmingewants to merge 10 commits intomain fromfix/issue-15579opened View on GitHub

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

x
0 of 19 viewed, 19 left
31 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,34 @@
}),
);
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)),
+ );