Repository navigation
Commit cfad2c4
committed
fix(server): preview resize and status report the real size of desktop tabs
In the desktop app the server drives each Browser panel tab through CDP,
and the desktop draws it in a webview. Playwright has no viewport for
those pages, so preview_resize always answered with the 1280x800
fallback. preview_status read innerWidth/innerHeight in a new isolated
world on every call and silently kept the last cached size when the read
failed or ran before the desktop had drawn, so after a freeform 1280x760
resize that the page had already applied, status could still report the
old size.
Status, resize, and the reads behind them now use what the server
already knows:
- Status keeps the measured size and reads the page again only after a
page resize, load, or dialog close marks it stale. This holds for
fixed settings (freeform and preset) too, because a page can keep
another size than the one asked for: a tab the desktop does not draw
kept 560x760 after an 844x390 request (#22942). A user's change to the
setting is recorded as soon as its session event arrives, so status
does not wait behind a running agent action to see it. A read that fails
or measures 0x0 leaves it stale, so the next status retries. A status
that arrives while a read is running waits for that read instead of
answering the size from before it.
- Resize captures a signal that the desktop page's next
Page.frameResized settles, before it publishes the new setting. When
the CSS size changes it waits for that resize, so the agent's next
snapshot sees the new size, the same as Playwright tabs where
setViewportSize is awaited. The wait is bounded by min(1 s, half the
time left before the request's deadline). Every resize then reads the
page, even if no resize arrived, within the rest of that time, so a
resize the page never draws still reports the size the page has and
answers before the request's deadline, even when it waited in the
tab's control queue.
The stale flag rides on the existing CDP listeners rather than starting
a read on every page resize, so a user dragging the panel costs nothing
until the next status. Remote viewers of desktop tabs keep their eager
size pushes unchanged. Playwright-owned tabs keep their current paths.
Status on a desktop tab now makes no CDP calls unless the page has
changed since the last read.
User story: When my agent resizes a preview in the desktop app's Browser panel, it is told the size the page really has, so it no longer makes layout decisions from a wrong 1280x800 or stale size.1 parent 09a54f0 commit cfad2c4
2 files changed
Lines changed: 145 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
1892 | 1893 | | |
1893 | 1894 | | |
1894 | 1895 | | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
1895 | 1983 | | |
1896 | 1984 | | |
1897 | 1985 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
328 | 330 | | |
329 | 331 | | |
330 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
331 | 337 | | |
332 | 338 | | |
333 | 339 | | |
| |||
666 | 672 | | |
667 | 673 | | |
668 | 674 | | |
| 675 | + | |
669 | 676 | | |
670 | 677 | | |
671 | 678 | | |
672 | 679 | | |
673 | 680 | | |
674 | 681 | | |
675 | 682 | | |
| 683 | + | |
676 | 684 | | |
677 | 685 | | |
678 | 686 | | |
| |||
887 | 895 | | |
888 | 896 | | |
889 | 897 | | |
| 898 | + | |
| 899 | + | |
890 | 900 | | |
891 | 901 | | |
892 | 902 | | |
| |||
904 | 914 | | |
905 | 915 | | |
906 | 916 | | |
| 917 | + | |
907 | 918 | | |
908 | 919 | | |
909 | | - | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
910 | 926 | | |
911 | 927 | | |
912 | 928 | | |
| |||
1618 | 1634 | | |
1619 | 1635 | | |
1620 | 1636 | | |
1621 | | - | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
1622 | 1643 | | |
1623 | 1644 | | |
1624 | 1645 | | |
| |||
2175 | 2196 | | |
2176 | 2197 | | |
2177 | 2198 | | |
2178 | | - | |
| 2199 | + | |
2179 | 2200 | | |
2180 | 2201 | | |
2181 | 2202 | | |
| |||
2191 | 2212 | | |
2192 | 2213 | | |
2193 | 2214 | | |
2194 | | - | |
| 2215 | + | |
2195 | 2216 | | |
2196 | 2217 | | |
2197 | 2218 | | |
| |||
2202 | 2223 | | |
2203 | 2224 | | |
2204 | 2225 | | |
2205 | | - | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
2206 | 2231 | | |
2207 | 2232 | | |
2208 | 2233 | | |
| |||
2219 | 2244 | | |
2220 | 2245 | | |
2221 | 2246 | | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
2222 | 2250 | | |
2223 | 2251 | | |
2224 | 2252 | | |
2225 | 2253 | | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
2226 | 2275 | | |
2227 | 2276 | | |
2228 | 2277 | | |
2229 | | - | |
| 2278 | + | |
2230 | 2279 | | |
2231 | 2280 | | |
2232 | 2281 | | |
| |||
2345 | 2394 | | |
2346 | 2395 | | |
2347 | 2396 | | |
| 2397 | + | |
| 2398 | + | |
2348 | 2399 | | |
2349 | 2400 | | |
2350 | 2401 | | |
| |||
0 commit comments