Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): remote viewers reach a tab the desktop cannot paint #27735

Openillumin3dpb-ship-it(GitHub profile, opens in a new tab)wants to merge 9 commits intomain fromrefs/pull/27735/headopened View on GitHub

Showing 2 changed files with 103 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
103 additions and 0 deletionsapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -114,6 +114,10 @@
if (method === "Page.getNavigationHistory") return { currentIndex: 0, entries: [{}] };
if (method === "Page.getLayoutMetrics") return { cssVisualViewport: { pageX: 0, pageY: 0 } };
if (method === "Page.captureScreenshot") {
+ if (desktopPaintsNothing) {
+ desktopCaptureStarted.resolve();
+ throw new Error("capture failed");
+ }
if ((input as { format: string }).format === "jpeg" && heldStill) await heldStill();
// A snapshot sizes its screenshot from the PNG header; viewers get JPEG frames as-is.
return { data: (input as { format: string }).format === "png" ? PNG_HEADER : "ZnJhbWU=" };
@@ -398,6 +402,9 @@
let desktopPageUrl = "about:blank";
/** Replaces the answer to the desktop page's size reads. */
let desktopSizeAnswer: (() => Promise<Record<string, unknown>>) | null = null;
+/** A minimized host: the guest paints no frame, so no still or screencast frame reaches a viewer. */
+let desktopPaintsNothing = false;
+let desktopCaptureStarted = Promise.withResolvers<void>();
const desktopDetaches = new NodeEvents.EventEmitter();
let desktopDetachReady = Promise.withResolvers<void>();
let desktopReleased = Promise.withResolvers<void>();
@@ -588,6 +595,8 @@
desktopAttachWaiting = Promise.withResolvers<void>();
desktopPageUrl = "about:blank";
desktopSizeAnswer = null;
+ desktopPaintsNothing = false;
+ desktopCaptureStarted = Promise.withResolvers<void>();
desktopDetachReady = Promise.withResolvers<void>();