ServerPack: one browser decision after the panel, pinned by scan
AfterPanel now asks ServerWebOpen.FallbackToBrowser first and opens the browser only there; the RefusedBeforeNavigate switch arm is gone. A source scan pins OpenInBrowser(r, done) to exactly two places (OpenWeb's browser route and right after the guard), so a browser open added to another arm (a spent code opened twice) fails the tests. Checked by mutation: an extra arm gives 3, a moved call fails the guard check. A newer Open answers the older waiting open Closed only once the engine has queued it; a refused or throwing second open leaves the first waiting (test added, RED against the old order). The SDK-name scan also covers the WebPanel*Fn table slots. Trailing newlines restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0ba3b5909e
commit
9a2cbb59c7
3 changed files with 58 additions and 12 deletions
|
|
@ -71,6 +71,14 @@ public sealed partial class ServerPackPlugin
|
|||
{
|
||||
try
|
||||
{
|
||||
// The one browser decision after the panel (ServerWebOpen.FallbackToBrowser: a refusal before
|
||||
// navigating only). Every other answer below ends without the browser: the code may be spent.
|
||||
if (ServerWebOpen.FallbackToBrowser(result))
|
||||
{
|
||||
LogTagged("web panel: " + result + ", using the browser");
|
||||
OpenInBrowser(r, done);
|
||||
return;
|
||||
}
|
||||
switch (result)
|
||||
{
|
||||
case PanelResult.Opened:
|
||||
|
|
@ -81,10 +89,6 @@ public sealed partial class ServerPackPlugin
|
|||
LogTagged("web panel: OpenedInBrowserByEngine");
|
||||
Finish(done, new WebOpenOutcome(WebOpenRoute.Browser, true, "Opened in your browser."));
|
||||
return;
|
||||
case PanelResult.RefusedBeforeNavigate:
|
||||
LogTagged("web panel: RefusedBeforeNavigate, using the browser");
|
||||
OpenInBrowser(r, done);
|
||||
return;
|
||||
case PanelResult.UrlNotAllowed:
|
||||
case PanelResult.BadArgs:
|
||||
// A plugin bug: the request did not pass the engine's checks. The browser would hide it.
|
||||
|
|
@ -225,4 +229,4 @@ public sealed partial class ServerPackPlugin
|
|||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private int WebPanelCloseCore(int handle) => Host.CloseWebPanel(handle);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue