Sessione salvata: correzioni della revisione di S4b (#36)
Un errore imprevisto durante la copia senza «Ho finito» (database, disco) non trattiene più per sempre il permesso di guida: la copia scrive solo il tipo d'errore e la guida finisce lo stesso, così il motore non resta in «Stai usando il browser». Un «Ho finito» tardivo dopo una copia fatta lasciando il browser dice che la sessione era già stata copiata invece di chiedere un nuovo accesso. Il registro distingue la finestra chiusa da quella ridotta a icona troppo a lungo. /api/engine e gli eventi prendono «Serve «Ho finito»» dall'istantanea del motore (EngineSnapshot.SessionCopyMissing) senza chiedere al browser a ogni evento. La prova di WebView2 aspetta la riga del registro, non solo la sessione in memoria. Documenti: nove operazioni GraphQL con __spin_*, H23 descritta in prove-dal-vivo (parte E), guida aggiornata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
883ea4683c
commit
c69755db23
20 files changed
+310
-54
No files matched your search
@@ -4,6 +4,7 @@ using System.Windows.Controls;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using Febe.App;
|
||||
using Febe.Desktop.Native;
|
||||
|
||||
namespace Febe.Desktop.Browser;
|
||||
@@ -135,8 +136,11 @@ internal sealed class BrowserWindow : Window
|
||||
/// <summary>Raised by «Pagina iniziale».</summary>
|
||||
public event EventHandler? HomeRequested;
|
||||
|
||||
/// <summary>Raised when Alberto closes the window, or leaves it minimised too long: the owner puts it out of view.</summary>
|
||||
public event EventHandler? DoneRequested;
|
||||
/// <summary>
|
||||
/// Raised when Alberto closes the window, or leaves it minimised too long (which one is the argument): the owner puts
|
||||
/// it out of view.
|
||||
/// </summary>
|
||||
public event EventHandler<BrowserWindowLetGo>? DoneRequested;
|
||||
|
||||
/// <summary>Raised when the page area changed size (a new fit): the owner sizes WebView2 again.</summary>
|
||||
public event EventHandler? PageAreaChanged;
|
||||
@@ -253,7 +257,7 @@ internal sealed class BrowserWindow : Window
|
||||
{
|
||||
// The browser stays open: closing the window means «ho finito», it goes out of view.
|
||||
e.Cancel = true;
|
||||
DoneRequested?.Invoke(this, EventArgs.Empty);
|
||||
DoneRequested?.Invoke(this, BrowserWindowLetGo.Closed);
|
||||
}
|
||||
|
||||
base.OnClosing(e);
|
||||
@@ -283,7 +287,7 @@ internal sealed class BrowserWindow : Window
|
||||
if (WindowState == WindowState.Minimized)
|
||||
{
|
||||
// Restored out of view by the owner (MoveOffScreen), never first on screen where it was.
|
||||
DoneRequested?.Invoke(this, EventArgs.Empty);
|
||||
DoneRequested?.Invoke(this, BrowserWindowLetGo.MinimizedTooLong);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,11 @@ namespace Febe.Desktop.Browser;
|
||||
/// once the engine's session ended and with the page's turn. Null: the button does nothing.
|
||||
/// </param>
|
||||
/// <param name="CopyOnClose">
|
||||
/// What closing the window does before the page goes back to the engine (issue #36, S4b): the connection copies the
|
||||
/// session, when it keeps a saved one. The window keeps the engine still until the task ends. Null: nothing.
|
||||
/// What closing the window (or leaving it minimised too long, the argument says which) does before the page goes back
|
||||
/// to the engine (issue #36, S4b): the connection copies the session, when it keeps a saved one. The window keeps the
|
||||
/// engine still until the task ends. Null: nothing.
|
||||
/// </param>
|
||||
internal sealed record WebView2HostOptions(BrowserHosting Hosting, string AdditionalBrowserArguments, ImageSource? Icon, Action MarkUsed, Func<CancellationToken, Task>? OpenStartPage = null, Func<CancellationToken, Task>? CopyOnClose = null);
|
||||
internal sealed record WebView2HostOptions(BrowserHosting Hosting, string AdditionalBrowserArguments, ImageSource? Icon, Action MarkUsed, Func<CancellationToken, Task>? OpenStartPage = null, Func<BrowserWindowLetGo, CancellationToken, Task>? CopyOnClose = null);
|
||||
|
||||
/// <summary>What the host does when a process of WebView2 fails (issue #52).</summary>
|
||||
internal enum ProcessFailureResponse
|
||||
@@ -353,7 +354,7 @@ internal sealed class WebView2Host : IBrowserHost
|
||||
window.MoveOffScreen();
|
||||
window.Show();
|
||||
window.Activated += OnActivated;
|
||||
window.DoneRequested += (_, _) => Done();
|
||||
window.DoneRequested += (_, how) => Done(how);
|
||||
window.BackRequested += (_, _) => UserNavigation(core => core.GoBack(), core => core.CanGoBack);
|
||||
window.ReloadRequested += (_, _) => UserNavigation(core => core.Reload(), _ => true);
|
||||
window.HomeRequested += (_, _) => OpenStartPage();
|
||||
@@ -563,7 +564,7 @@ internal sealed class WebView2Host : IBrowserHost
|
||||
/// (S4b) the session is copied first: a hold of the driving gate keeps the page his until the copy is over, and only
|
||||
/// then does it go back to the engine (rule 7).
|
||||
/// </summary>
|
||||
private void Done()
|
||||
private void Done(BrowserWindowLetGo how)
|
||||
{
|
||||
_window?.MoveOffScreen();
|
||||
NotifyPositionChanged();
|
||||
@@ -575,14 +576,14 @@ internal sealed class WebView2Host : IBrowserHost
|
||||
|
||||
var hold = UserDriving.Begin();
|
||||
ReleaseLease();
|
||||
_ = CopyThenLetGoAsync(copy, hold);
|
||||
_ = CopyThenLetGoAsync(copy, how, hold);
|
||||
}
|
||||
|
||||
private async Task CopyThenLetGoAsync(Func<CancellationToken, Task> copy, IDisposable hold)
|
||||
private async Task CopyThenLetGoAsync(Func<BrowserWindowLetGo, CancellationToken, Task> copy, BrowserWindowLetGo how, IDisposable hold)
|
||||
{
|
||||
try
|
||||
{
|
||||
await copy(CancellationToken.None).ConfigureAwait(true);
|
||||
await copy(how, CancellationToken.None).ConfigureAwait(true);
|
||||
}
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user