Correzione: il browser che non risponde ancora si aspetta, poi si apre l'accesso (#67)
Subito dopo «Scollega» il browser riparte con il profilo vuoto e, sotto carico, può non dire ancora quale pagina mostra. Febe prendeva l'indirizzo sconosciuto per una pagina di Alberto e lasciava la finestra bianca (about:blank), contro la #52. Decisione di Alberto del 29 novembre 2026: quando l'indirizzo è sconosciuto si richiede al browser ogni 200 ms, al massimo per 10 secondi (AddressWait); se resta muto la pagina conta come quella di riposo e si apre la pagina iniziale (l'accesso, senza sessione). Una pagina nota che Alberto usa non si tocca mai; l'attesa finisce con la richiesta. Il finto browser delle prove può restare muto (Silent): quattro prove nuove per la risposta tardiva, il silenzio oltre l'attesa, la pagina di Alberto lasciata com'è e l'annullamento durante l'attesa. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f48384b7d4
commit
8edb706e06
3 files changed
+179
-5
No files matched your search
@@ -263,6 +263,8 @@ internal sealed class FakeCdp : ICdpSession
|
||||
private readonly Dictionary<string, List<Action<JsonElement>>> _handlers = new(StringComparer.Ordinal);
|
||||
private int _captureReads;
|
||||
private int _cookieReads;
|
||||
private bool _silent;
|
||||
private int _silentAnswers;
|
||||
|
||||
public bool LoggedIn { get; set; }
|
||||
|
||||
@@ -313,6 +315,19 @@ internal sealed class FakeCdp : ICdpSession
|
||||
|
||||
public string Url { get; private set; } = "about:blank";
|
||||
|
||||
/// <summary>
|
||||
/// While true the page does not say where it is, like a browser that has just restarted and does not answer yet
|
||||
/// (issue #67): <c>Page.getFrameTree</c> fails as a closed connection, and is counted in <see cref="SilentAnswers"/>.
|
||||
/// </summary>
|
||||
public bool Silent
|
||||
{
|
||||
get => Volatile.Read(ref _silent);
|
||||
set => Volatile.Write(ref _silent, value);
|
||||
}
|
||||
|
||||
/// <summary>How many times <c>Page.getFrameTree</c> was asked while <see cref="Silent"/>.</summary>
|
||||
public int SilentAnswers => Volatile.Read(ref _silentAnswers);
|
||||
|
||||
public ConcurrentQueue<string> Methods { get; } = new();
|
||||
|
||||
/// <summary>Every address a <c>Page.navigate</c> asked for, in order.</summary>
|
||||
@@ -329,6 +344,12 @@ internal sealed class FakeCdp : ICdpSession
|
||||
{
|
||||
CdpCommandPolicy.EnsureAllowed(method);
|
||||
Methods.Enqueue(method);
|
||||
if (method == "Page.getFrameTree" && Silent)
|
||||
{
|
||||
Interlocked.Increment(ref _silentAnswers);
|
||||
return Task.FromException<JsonElement>(new CdpDisconnectedException());
|
||||
}
|
||||
|
||||
JsonNode result = method switch
|
||||
{
|
||||
"Page.getFrameTree" => new JsonObject { ["frameTree"] = new JsonObject { ["frame"] = new JsonObject { ["id"] = "F1", ["url"] = Url } } },
|
||||
|
||||
Reference in new issue
Block a user