Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ export class BrowserLifecycleService extends AbstractLifecycleService {
private doShutdown(vetoShutdown?: () => void): void {
const logService = this.logService;

let storageServiceVeto = true;
// Optimistically trigger a UI state flush
// without waiting for it. The browser does
// not guarantee that this is being executed
// but if a dialog opens, we have a chance
// to succeed.
this.storageService.flush(WillSaveStateReason.SHUTDOWN);
// If the refresh is not completed, it needs to be regarded as a veto to try to evoke the dialog.
this.storageService.flush(WillSaveStateReason.SHUTDOWN).finally(() => storageServiceVeto = false);

let veto = false;

Expand Down Expand Up @@ -148,7 +150,7 @@ export class BrowserLifecycleService extends AbstractLifecycleService {
});

// Veto: handle if provided
if (veto && typeof vetoShutdown === 'function') {
if ((veto || storageServiceVeto) && typeof vetoShutdown === 'function') {
return vetoShutdown();
}

Expand Down