Revisione: il browser che non risponde nemmeno alla navigazione viene comunque in primo piano (#67)
Con la correzione #67 un browser che resta muto per tutta l'attesa conta come a riposo, e Febe prova ad aprire la pagina iniziale. Un browser che si sta ancora riavviando dopo «Scollega» rifiuta però anche Page.navigate: l'errore risaliva fino all'API e Alberto vedeva, dopo dieci secondi, un errore interno al posto della finestra. Ora quella navigazione mancata si annota nel registro («non aperta (il browser non risponde)») e la finestra viene in primo piano come prima. Nuova prova con un browser che non risponde a nulla, per «Usa il browser» e «Apri il browser». Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8edb706e06
commit
8d1b344366
3 files changed
+56
-1
No files matched your search
@@ -265,6 +265,7 @@ internal sealed class FakeCdp : ICdpSession
|
||||
private int _cookieReads;
|
||||
private bool _silent;
|
||||
private int _silentAnswers;
|
||||
private bool _refusesNavigation;
|
||||
|
||||
public bool LoggedIn { get; set; }
|
||||
|
||||
@@ -328,6 +329,16 @@ internal sealed class FakeCdp : ICdpSession
|
||||
/// <summary>How many times <c>Page.getFrameTree</c> was asked while <see cref="Silent"/>.</summary>
|
||||
public int SilentAnswers => Volatile.Read(ref _silentAnswers);
|
||||
|
||||
/// <summary>
|
||||
/// While true <c>Page.navigate</c> fails as a closed connection too, like a browser that has not finished restarting
|
||||
/// (issue #67): with <see cref="Silent"/>, a browser that answers nothing at all.
|
||||
/// </summary>
|
||||
public bool RefusesNavigation
|
||||
{
|
||||
get => Volatile.Read(ref _refusesNavigation);
|
||||
set => Volatile.Write(ref _refusesNavigation, value);
|
||||
}
|
||||
|
||||
public ConcurrentQueue<string> Methods { get; } = new();
|
||||
|
||||
/// <summary>Every address a <c>Page.navigate</c> asked for, in order.</summary>
|
||||
@@ -350,6 +361,11 @@ internal sealed class FakeCdp : ICdpSession
|
||||
return Task.FromException<JsonElement>(new CdpDisconnectedException());
|
||||
}
|
||||
|
||||
if (method == "Page.navigate" && RefusesNavigation)
|
||||
{
|
||||
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