Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): bound screencast delivery to slow consumers #28518

MergedHomemadeToast57(GitHub profile, opens in a new tab)merged 12 commits intomain fromrefs/pull/28518/headmerged by juliusmarminge View on GitHub

Showing 5 changed files with 134 additions and 12 deletions (loading 2).

x
0 of 5 viewed, 5 left
65 additions and 4 deletionsapps/desktop/src/preview/CdpRelay.test.tsModified
View file
@@ -9,6 +9,7 @@
const makeTarget = (
send: CdpRelayTarget["send"],
setDownloadDirectory: CdpRelayTarget["setDownloadDirectory"] = () => {},
+ ackScreencastFrame: CdpRelayTarget["ackScreencastFrame"] = () => {},
): CdpRelayTarget => ({
send,
targetId: async () => "GUEST-TARGET",
@@ -17,6 +18,7 @@
userAgent: () => "Electron",
setDownloadDirectory,
receivesScreencast: () => true,
+ ackScreencastFrame,
});
​
const makeRelay = (target: CdpRelayTarget, write: (raw: string) => void) =>
@@ -138,9 +140,13 @@
​
describe("CDP relay extra sessions", () => {
it("gives a second page session the page's commands and events", async () => {
- const send = vi.fn(async () => ({}));
+ const send = vi.fn<CdpRelayTarget["send"]>(async () => ({}));
const written: Array<Record<string, unknown>> = [];
- const relay = makeRelay(makeTarget(send), (raw) => written.push(JSON.parse(raw)));
+ const nativeAcks: Array<number> = [];
+ const relay = makeRelay(
+ makeTarget(send, undefined, (frameId) => nativeAcks.push(frameId)),
+ (raw) => written.push(JSON.parse(raw)),