@@ -135,7 +135,7 @@ const makeTestPreviewWebContents = (
135135 getType : ( ) => "webview" ,
136136 getURL : ( ) => "https://example.com" ,
137137 getTitle : ( ) => "Example" ,
138- isLoading : ( ) => false ,
138+ isLoadingMainFrame : ( ) => false ,
139139 getZoomFactor : ( ) => 1 ,
140140 setZoomFactor : vi . fn ( ) ,
141141 setAudioMuted : vi . fn ( ) ,
@@ -250,7 +250,7 @@ describe("fork preview manager zoom and window close", () => {
250250 getType : ( ) => "webview" ,
251251 getURL : ( ) => "https://example.com" ,
252252 getTitle : ( ) => "Example" ,
253- isLoading : ( ) => false ,
253+ isLoadingMainFrame : ( ) => false ,
254254 getZoomFactor : ( ) => 1 ,
255255 setZoomFactor,
256256 setAudioMuted : vi . fn ( ) ,
@@ -293,15 +293,7 @@ describe("fork preview manager zoom and window close", () => {
293293 ) ,
294294 ) ;
295295
296- // Fork tabs belong to a window, so its close disposes them (commit `70240ecf8e5`).
297- forkSupersedes ( {
298- upstream :
299- "apps/desktop/src/preview/Manager.test.ts > releases frame capture when the main window closes" ,
300- reason :
301- "fork disposes the closing window's preview tabs, so a raced start finds no tab instead of PreviewMainWindowClosedError, and other windows' tabs stay live" ,
302- commit : "70240ecf8e5" ,
303- } ) ;
304- effectIt . effect ( "disposes preview tabs when their owning window closes" , ( ) =>
296+ effectIt . effect ( "releases app recording without disposing other windows' tabs" , ( ) =>
305297 withManager ( ( manager ) =>
306298 Effect . gen ( function * ( ) {
307299 let closeMainWindow : ( ( ) => void ) | undefined ;
@@ -320,9 +312,10 @@ describe("fork preview manager zoom and window close", () => {
320312 id === undefined ? null : ( webContentsById . get ( id ) ?? null ) ,
321313 ) ;
322314
323- const otherWindow = yield * manager . forWindow (
324- "00000000-0000-4000-8000-00000000000c" as WindowId ,
325- ) ;
315+ const otherWindowId = "00000000-0000-4000-8000-00000000000c" as WindowId ;
316+ const otherWindow = yield * manager . forWindow ( otherWindowId ) ;
317+ // The other window keeps its creation zoom across the app window's close.
318+ yield * otherWindow . createTab ( "tab_other_window" , { zoomFactor : 1.25 } ) ;
326319 yield * otherWindow . navigate ( "tab_other_window" , "https://other.example" ) ;
327320 yield * manager . createTab ( "tab_window_close_recording" ) ;
328321 yield * manager . createTab ( "tab_window_close_race" ) ;
@@ -339,20 +332,28 @@ describe("fork preview manager zoom and window close", () => {
339332 expect ( firstWindowThrottling . mock . calls ) . toEqual ( [ [ false ] ] ) ;
340333
341334 closeMainWindow ?.( ) ;
335+ const otherWindowState : PreviewManager . PreviewTabState [ ] = [ ] ;
336+ yield * manager . subscribeOwnedStateChanges ( ( owner , _tabId , state ) =>
337+ Effect . sync ( ( ) => {
338+ if ( owner === otherWindowId ) otherWindowState . push ( state ) ;
339+ } ) ,
340+ ) ;
342341 const racedStart = yield * Effect . exit ( manager . startRecording ( "tab_window_close_race" ) ) ;
343342 expect ( Exit . isFailure ( racedStart ) ) . toBe ( true ) ;
344343 if ( Exit . isFailure ( racedStart ) ) {
345344 expect ( Option . getOrThrow ( Cause . findErrorOption ( racedStart . cause ) ) ) . toMatchObject ( {
346- _tag : "PreviewTabNotFoundError" ,
347- tabId : "tab_window_close_race" ,
345+ _tag : "PreviewMainWindowClosedError" ,
348346 } ) ;
349347 }
350348 yield * Effect . yieldNow ;
351349 yield * Effect . yieldNow ;
352- expect ( yield * otherWindow . automationStatus ( "tab_other_window" ) ) . toMatchObject ( {
350+ yield * otherWindow . navigate ( "tab_other_window" , "https://other.example/after" ) ;
351+ // The other window's tab outlived the main window's close: the post-close
352+ // navigation still drives the tab created before it, creation zoom intact.
353+ expect ( otherWindowState . at ( - 1 ) ) . toMatchObject ( {
353354 tabId : "tab_other_window" ,
354- url : "https://other.example/" ,
355- loading : true ,
355+ navStatus : { kind : "Loading" , url : "https://other.example/after" } ,
356+ zoomFactor : 1.25 ,
356357 } ) ;
357358
358359 const grants : Array < { video ?: unknown } > = [ ] ;
@@ -369,14 +370,6 @@ describe("fork preview manager zoom and window close", () => {
369370 ) ,
370371 ) ;
371372
372- // Fork registers a closed listener per owner (commit `70240ecf8e5`).
373- forkSupersedes ( {
374- upstream :
375- "apps/desktop/src/preview/Manager.test.ts > does not arm recording after the main window closes during warmup" ,
376- reason :
377- "fork registers more than one closed listener on the main window, and the upstream case keeps only the last one it was handed" ,
378- commit : "70240ecf8e5" ,
379- } ) ;
380373 effectIt . effect ( "does not arm recording when every close listener runs during warmup" , ( ) =>
381374 withManager ( ( manager ) =>
382375 Effect . gen ( function * ( ) {
0 commit comments